migrate

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// WithGlobalUniqueID sets the universal ids options to the migration.
	// If this option is enabled, ent migration will allocate a 1<<32 range
	// for the ids of each entity (table).
	// Note that this option cannot be applied on tables that already exist.
	WithGlobalUniqueID = schema.WithGlobalUniqueID
	// WithDropColumn sets the drop column option to the migration.
	// If this option is enabled, ent migration will drop old columns
	// that were used for both fields and edges. This defaults to false.
	WithDropColumn = schema.WithDropColumn
	// WithDropIndex sets the drop index option to the migration.
	// If this option is enabled, ent migration will drop old indexes
	// that were defined in the schema. This defaults to false.
	// Note that unique constraints are defined using `UNIQUE INDEX`,
	// and therefore, it's recommended to enable this option to get more
	// flexibility in the schema changes.
	WithDropIndex = schema.WithDropIndex
	// WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true.
	WithForeignKeys = schema.WithForeignKeys
)
View Source
var (
	// CfAPIKeysColumns holds the columns for the "cf_api_keys" table.
	CfAPIKeysColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "name", Type: field.TypeString},
		{Name: "prefix", Type: field.TypeString, Unique: true},
		{Name: "key_hash", Type: field.TypeString},
		{Name: "scopes", Type: field.TypeJSON, Nullable: true},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "expires_at", Type: field.TypeTime, Nullable: true},
		{Name: "last_used_at", Type: field.TypeTime, Nullable: true},
		{Name: "last_used_ip", Type: field.TypeString, Nullable: true},
		{Name: "revoked", Type: field.TypeBool, Default: false},
		{Name: "revoked_at", Type: field.TypeTime, Nullable: true},
		{Name: "revoked_reason", Type: field.TypeString, Nullable: true},
		{Name: "environment", Type: field.TypeEnum, Enums: []string{"live", "test"}, Default: "live"},
		{Name: "metadata", Type: field.TypeJSON, Nullable: true},
		{Name: "organization_api_keys", Type: field.TypeUUID, Nullable: true},
		{Name: "user_api_keys", Type: field.TypeUUID},
	}
	// CfAPIKeysTable holds the schema information for the "cf_api_keys" table.
	CfAPIKeysTable = &schema.Table{
		Name:       "cf_api_keys",
		Columns:    CfAPIKeysColumns,
		PrimaryKey: []*schema.Column{CfAPIKeysColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_api_keys_cf_organizations_api_keys",
				Columns:    []*schema.Column{CfAPIKeysColumns[16]},
				RefColumns: []*schema.Column{CfOrganizationsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "cf_api_keys_cf_users_api_keys",
				Columns:    []*schema.Column{CfAPIKeysColumns[17]},
				RefColumns: []*schema.Column{CfUsersColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "apikey_prefix",
				Unique:  true,
				Columns: []*schema.Column{CfAPIKeysColumns[4]},
			},
			{
				Name:    "apikey_user_api_keys",
				Unique:  false,
				Columns: []*schema.Column{CfAPIKeysColumns[17]},
			},
			{
				Name:    "apikey_organization_api_keys",
				Unique:  false,
				Columns: []*schema.Column{CfAPIKeysColumns[16]},
			},
			{
				Name:    "apikey_revoked_expires_at",
				Unique:  false,
				Columns: []*schema.Column{CfAPIKeysColumns[11], CfAPIKeysColumns[8]},
			},
			{
				Name:    "apikey_environment",
				Unique:  false,
				Columns: []*schema.Column{CfAPIKeysColumns[14]},
			},
		},
	}
	// CfAgentsColumns holds the columns for the "cf_agents" table.
	CfAgentsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "model_id", Type: field.TypeString},
		{Name: "version", Type: field.TypeString, Nullable: true},
		{Name: "capability_constraints", Type: field.TypeJSON},
		{Name: "resource_constraints", Type: field.TypeJSON},
		{Name: "max_token_lifetime", Type: field.TypeInt, Default: 3600},
		{Name: "session_id", Type: field.TypeString, Nullable: true},
		{Name: "requires_confirmation", Type: field.TypeBool, Default: true},
		{Name: "delegating_principal_id", Type: field.TypeUUID, Nullable: true},
		{Name: "principal_id", Type: field.TypeUUID, Unique: true},
	}
	// CfAgentsTable holds the schema information for the "cf_agents" table.
	CfAgentsTable = &schema.Table{
		Name:       "cf_agents",
		Columns:    CfAgentsColumns,
		PrimaryKey: []*schema.Column{CfAgentsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_agents_cf_principals_delegating_principal",
				Columns:    []*schema.Column{CfAgentsColumns[10]},
				RefColumns: []*schema.Column{CfPrincipalsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "cf_agents_cf_principals_agent",
				Columns:    []*schema.Column{CfAgentsColumns[11]},
				RefColumns: []*schema.Column{CfPrincipalsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "agent_principal_id",
				Unique:  true,
				Columns: []*schema.Column{CfAgentsColumns[11]},
			},
			{
				Name:    "agent_model_id",
				Unique:  false,
				Columns: []*schema.Column{CfAgentsColumns[3]},
			},
			{
				Name:    "agent_delegating_principal_id",
				Unique:  false,
				Columns: []*schema.Column{CfAgentsColumns[10]},
			},
			{
				Name:    "agent_session_id",
				Unique:  false,
				Columns: []*schema.Column{CfAgentsColumns[8]},
			},
			{
				Name:    "agent_requires_confirmation",
				Unique:  false,
				Columns: []*schema.Column{CfAgentsColumns[9]},
			},
		},
	}
	// CfApplicationsColumns holds the columns for the "cf_applications" table.
	CfApplicationsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "client_id", Type: field.TypeString, Unique: true},
		{Name: "description", Type: field.TypeString, Nullable: true, Size: 1000},
		{Name: "logo_url", Type: field.TypeString, Nullable: true},
		{Name: "app_type", Type: field.TypeEnum, Enums: []string{"web", "spa", "native", "machine"}, Default: "web"},
		{Name: "redirect_uris", Type: field.TypeJSON},
		{Name: "allowed_grants", Type: field.TypeJSON},
		{Name: "allowed_response_types", Type: field.TypeJSON},
		{Name: "access_token_ttl", Type: field.TypeInt, Default: 900},
		{Name: "refresh_token_ttl", Type: field.TypeInt, Default: 604800},
		{Name: "refresh_token_rotation", Type: field.TypeBool, Default: true},
		{Name: "first_party", Type: field.TypeBool, Default: false},
		{Name: "public", Type: field.TypeBool, Default: false},
		{Name: "principal_id", Type: field.TypeUUID, Unique: true},
	}
	// CfApplicationsTable holds the schema information for the "cf_applications" table.
	CfApplicationsTable = &schema.Table{
		Name:       "cf_applications",
		Columns:    CfApplicationsColumns,
		PrimaryKey: []*schema.Column{CfApplicationsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_applications_cf_principals_application",
				Columns:    []*schema.Column{CfApplicationsColumns[15]},
				RefColumns: []*schema.Column{CfPrincipalsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "application_principal_id",
				Unique:  true,
				Columns: []*schema.Column{CfApplicationsColumns[15]},
			},
			{
				Name:    "application_client_id",
				Unique:  true,
				Columns: []*schema.Column{CfApplicationsColumns[3]},
			},
			{
				Name:    "application_app_type",
				Unique:  false,
				Columns: []*schema.Column{CfApplicationsColumns[6]},
			},
			{
				Name:    "application_first_party",
				Unique:  false,
				Columns: []*schema.Column{CfApplicationsColumns[13]},
			},
		},
	}
	// CfCredentialsColumns holds the columns for the "cf_credentials" table.
	CfCredentialsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "type", Type: field.TypeEnum, Enums: []string{"password", "api_key", "keypair", "webauthn", "totp", "client_secret"}},
		{Name: "identifier", Type: field.TypeString, Nullable: true},
		{Name: "secret_hash", Type: field.TypeString, Nullable: true},
		{Name: "public_key", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "key_algorithm", Type: field.TypeString, Nullable: true},
		{Name: "key_id", Type: field.TypeString, Unique: true, Nullable: true},
		{Name: "webauthn_credential_id", Type: field.TypeBytes, Nullable: true},
		{Name: "webauthn_public_key", Type: field.TypeBytes, Nullable: true},
		{Name: "webauthn_aaguid", Type: field.TypeString, Nullable: true},
		{Name: "webauthn_sign_count", Type: field.TypeUint32, Nullable: true, Default: 0},
		{Name: "scopes", Type: field.TypeJSON},
		{Name: "active", Type: field.TypeBool, Default: true},
		{Name: "expires_at", Type: field.TypeTime, Nullable: true},
		{Name: "revoked", Type: field.TypeBool, Default: false},
		{Name: "revoked_at", Type: field.TypeTime, Nullable: true},
		{Name: "revoked_reason", Type: field.TypeString, Nullable: true},
		{Name: "last_used_at", Type: field.TypeTime, Nullable: true},
		{Name: "last_used_ip", Type: field.TypeString, Nullable: true},
		{Name: "name", Type: field.TypeString, Nullable: true},
		{Name: "metadata", Type: field.TypeJSON, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "principal_id", Type: field.TypeUUID},
	}
	// CfCredentialsTable holds the schema information for the "cf_credentials" table.
	CfCredentialsTable = &schema.Table{
		Name:       "cf_credentials",
		Columns:    CfCredentialsColumns,
		PrimaryKey: []*schema.Column{CfCredentialsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_credentials_cf_principals_credentials",
				Columns:    []*schema.Column{CfCredentialsColumns[23]},
				RefColumns: []*schema.Column{CfPrincipalsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "credential_principal_id",
				Unique:  false,
				Columns: []*schema.Column{CfCredentialsColumns[23]},
			},
			{
				Name:    "credential_principal_id_type",
				Unique:  false,
				Columns: []*schema.Column{CfCredentialsColumns[23], CfCredentialsColumns[1]},
			},
			{
				Name:    "credential_type",
				Unique:  false,
				Columns: []*schema.Column{CfCredentialsColumns[1]},
			},
			{
				Name:    "credential_identifier",
				Unique:  false,
				Columns: []*schema.Column{CfCredentialsColumns[2]},
			},
			{
				Name:    "credential_active",
				Unique:  false,
				Columns: []*schema.Column{CfCredentialsColumns[12]},
			},
			{
				Name:    "credential_revoked",
				Unique:  false,
				Columns: []*schema.Column{CfCredentialsColumns[14]},
			},
			{
				Name:    "credential_expires_at",
				Unique:  false,
				Columns: []*schema.Column{CfCredentialsColumns[13]},
			},
			{
				Name:    "credential_type_identifier",
				Unique:  true,
				Columns: []*schema.Column{CfCredentialsColumns[1], CfCredentialsColumns[2]},
			},
		},
	}
	// CfHumansColumns holds the columns for the "cf_humans" table.
	CfHumansColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "email", Type: field.TypeString, Unique: true},
		{Name: "given_name", Type: field.TypeString, Nullable: true},
		{Name: "family_name", Type: field.TypeString, Nullable: true},
		{Name: "avatar_url", Type: field.TypeString, Nullable: true},
		{Name: "locale", Type: field.TypeString, Nullable: true, Default: "en"},
		{Name: "timezone", Type: field.TypeString, Nullable: true, Default: "UTC"},
		{Name: "is_platform_admin", Type: field.TypeBool, Default: false},
		{Name: "last_login_at", Type: field.TypeTime, Nullable: true},
		{Name: "email_verified_at", Type: field.TypeTime, Nullable: true},
		{Name: "principal_id", Type: field.TypeUUID, Unique: true},
	}
	// CfHumansTable holds the schema information for the "cf_humans" table.
	CfHumansTable = &schema.Table{
		Name:       "cf_humans",
		Columns:    CfHumansColumns,
		PrimaryKey: []*schema.Column{CfHumansColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_humans_cf_principals_human",
				Columns:    []*schema.Column{CfHumansColumns[12]},
				RefColumns: []*schema.Column{CfPrincipalsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "human_principal_id",
				Unique:  true,
				Columns: []*schema.Column{CfHumansColumns[12]},
			},
			{
				Name:    "human_email",
				Unique:  true,
				Columns: []*schema.Column{CfHumansColumns[3]},
			},
			{
				Name:    "human_is_platform_admin",
				Unique:  false,
				Columns: []*schema.Column{CfHumansColumns[9]},
			},
		},
	}
	// CfInvitesColumns holds the columns for the "cf_invites" table.
	CfInvitesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "email", Type: field.TypeString},
		{Name: "role", Type: field.TypeString, Default: "member"},
		{Name: "token", Type: field.TypeString, Unique: true},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"pending", "accepted", "declined", "expired", "revoked"}, Default: "pending"},
		{Name: "message", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "expires_at", Type: field.TypeTime},
		{Name: "accepted_at", Type: field.TypeTime, Nullable: true},
		{Name: "accepted_by_principal_id", Type: field.TypeUUID, Nullable: true},
		{Name: "resend_count", Type: field.TypeInt, Default: 0},
		{Name: "last_sent_at", Type: field.TypeTime},
		{Name: "organization_id", Type: field.TypeUUID},
		{Name: "inviter_principal_id", Type: field.TypeUUID},
	}
	// CfInvitesTable holds the schema information for the "cf_invites" table.
	CfInvitesTable = &schema.Table{
		Name:       "cf_invites",
		Columns:    CfInvitesColumns,
		PrimaryKey: []*schema.Column{CfInvitesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_invites_cf_organizations_invites",
				Columns:    []*schema.Column{CfInvitesColumns[13]},
				RefColumns: []*schema.Column{CfOrganizationsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "cf_invites_cf_principals_sent_invites",
				Columns:    []*schema.Column{CfInvitesColumns[14]},
				RefColumns: []*schema.Column{CfPrincipalsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "invite_token",
				Unique:  true,
				Columns: []*schema.Column{CfInvitesColumns[5]},
			},
			{
				Name:    "invite_email",
				Unique:  false,
				Columns: []*schema.Column{CfInvitesColumns[3]},
			},
			{
				Name:    "invite_organization_id",
				Unique:  false,
				Columns: []*schema.Column{CfInvitesColumns[13]},
			},
			{
				Name:    "invite_organization_id_status",
				Unique:  false,
				Columns: []*schema.Column{CfInvitesColumns[13], CfInvitesColumns[6]},
			},
			{
				Name:    "invite_organization_id_email_status",
				Unique:  false,
				Columns: []*schema.Column{CfInvitesColumns[13], CfInvitesColumns[3], CfInvitesColumns[6]},
			},
			{
				Name:    "invite_inviter_principal_id",
				Unique:  false,
				Columns: []*schema.Column{CfInvitesColumns[14]},
			},
			{
				Name:    "invite_status_expires_at",
				Unique:  false,
				Columns: []*schema.Column{CfInvitesColumns[6], CfInvitesColumns[8]},
			},
		},
	}
	// CfMembershipsColumns holds the columns for the "cf_memberships" table.
	CfMembershipsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "role", Type: field.TypeString},
		{Name: "permissions", Type: field.TypeJSON, Nullable: true},
		{Name: "organization_id", Type: field.TypeUUID},
		{Name: "user_id", Type: field.TypeUUID},
	}
	// CfMembershipsTable holds the schema information for the "cf_memberships" table.
	CfMembershipsTable = &schema.Table{
		Name:       "cf_memberships",
		Columns:    CfMembershipsColumns,
		PrimaryKey: []*schema.Column{CfMembershipsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_memberships_cf_organizations_memberships",
				Columns:    []*schema.Column{CfMembershipsColumns[5]},
				RefColumns: []*schema.Column{CfOrganizationsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "cf_memberships_cf_users_memberships",
				Columns:    []*schema.Column{CfMembershipsColumns[6]},
				RefColumns: []*schema.Column{CfUsersColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "membership_user_id_organization_id",
				Unique:  true,
				Columns: []*schema.Column{CfMembershipsColumns[6], CfMembershipsColumns[5]},
			},
			{
				Name:    "membership_user_id",
				Unique:  false,
				Columns: []*schema.Column{CfMembershipsColumns[6]},
			},
			{
				Name:    "membership_organization_id",
				Unique:  false,
				Columns: []*schema.Column{CfMembershipsColumns[5]},
			},
			{
				Name:    "membership_role",
				Unique:  false,
				Columns: []*schema.Column{CfMembershipsColumns[3]},
			},
		},
	}
	// CfOauthAccountsColumns holds the columns for the "cf_oauth_accounts" table.
	CfOauthAccountsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "provider", Type: field.TypeString},
		{Name: "provider_user_id", Type: field.TypeString},
		{Name: "access_token", Type: field.TypeString, Nullable: true},
		{Name: "refresh_token", Type: field.TypeString, Nullable: true},
		{Name: "token_expires_at", Type: field.TypeTime, Nullable: true},
		{Name: "user_id", Type: field.TypeUUID},
	}
	// CfOauthAccountsTable holds the schema information for the "cf_oauth_accounts" table.
	CfOauthAccountsTable = &schema.Table{
		Name:       "cf_oauth_accounts",
		Columns:    CfOauthAccountsColumns,
		PrimaryKey: []*schema.Column{CfOauthAccountsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_oauth_accounts_cf_users_oauth_accounts",
				Columns:    []*schema.Column{CfOauthAccountsColumns[8]},
				RefColumns: []*schema.Column{CfUsersColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "oauthaccount_provider_provider_user_id",
				Unique:  true,
				Columns: []*schema.Column{CfOauthAccountsColumns[3], CfOauthAccountsColumns[4]},
			},
			{
				Name:    "oauthaccount_user_id",
				Unique:  false,
				Columns: []*schema.Column{CfOauthAccountsColumns[8]},
			},
			{
				Name:    "oauthaccount_provider",
				Unique:  false,
				Columns: []*schema.Column{CfOauthAccountsColumns[3]},
			},
		},
	}
	// CfOauthAppsColumns holds the columns for the "cf_oauth_apps" table.
	CfOauthAppsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "client_id", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString, Size: 255},
		{Name: "description", Type: field.TypeString, Nullable: true, Size: 1000},
		{Name: "logo_url", Type: field.TypeString, Nullable: true},
		{Name: "app_type", Type: field.TypeEnum, Enums: []string{"web", "spa", "native", "service", "machine"}, Default: "web"},
		{Name: "redirect_uris", Type: field.TypeJSON},
		{Name: "allowed_scopes", Type: field.TypeJSON},
		{Name: "allowed_grants", Type: field.TypeJSON},
		{Name: "allowed_response_types", Type: field.TypeJSON},
		{Name: "access_token_ttl", Type: field.TypeInt, Default: 900},
		{Name: "refresh_token_ttl", Type: field.TypeInt, Default: 604800},
		{Name: "refresh_token_rotation", Type: field.TypeBool, Default: true},
		{Name: "first_party", Type: field.TypeBool, Default: false},
		{Name: "public", Type: field.TypeBool, Default: false},
		{Name: "active", Type: field.TypeBool, Default: true},
		{Name: "revoked_at", Type: field.TypeTime, Nullable: true},
		{Name: "metadata", Type: field.TypeJSON, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "organization_id", Type: field.TypeUUID, Nullable: true},
		{Name: "owner_id", Type: field.TypeUUID},
	}
	// CfOauthAppsTable holds the schema information for the "cf_oauth_apps" table.
	CfOauthAppsTable = &schema.Table{
		Name:       "cf_oauth_apps",
		Columns:    CfOauthAppsColumns,
		PrimaryKey: []*schema.Column{CfOauthAppsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_oauth_apps_cf_organizations_oauth_apps",
				Columns:    []*schema.Column{CfOauthAppsColumns[20]},
				RefColumns: []*schema.Column{CfOrganizationsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "cf_oauth_apps_cf_users_oauth_apps",
				Columns:    []*schema.Column{CfOauthAppsColumns[21]},
				RefColumns: []*schema.Column{CfUsersColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "oauthapp_client_id",
				Unique:  true,
				Columns: []*schema.Column{CfOauthAppsColumns[1]},
			},
			{
				Name:    "oauthapp_owner_id",
				Unique:  false,
				Columns: []*schema.Column{CfOauthAppsColumns[21]},
			},
			{
				Name:    "oauthapp_organization_id",
				Unique:  false,
				Columns: []*schema.Column{CfOauthAppsColumns[20]},
			},
			{
				Name:    "oauthapp_active",
				Unique:  false,
				Columns: []*schema.Column{CfOauthAppsColumns[15]},
			},
		},
	}
	// CfOauthAppSecretsColumns holds the columns for the "cf_oauth_app_secrets" table.
	CfOauthAppSecretsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "secret_hash", Type: field.TypeString},
		{Name: "secret_prefix", Type: field.TypeString, Size: 12},
		{Name: "expires_at", Type: field.TypeTime, Nullable: true},
		{Name: "last_used_at", Type: field.TypeTime, Nullable: true},
		{Name: "revoked", Type: field.TypeBool, Default: false},
		{Name: "revoked_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "app_id", Type: field.TypeUUID},
	}
	// CfOauthAppSecretsTable holds the schema information for the "cf_oauth_app_secrets" table.
	CfOauthAppSecretsTable = &schema.Table{
		Name:       "cf_oauth_app_secrets",
		Columns:    CfOauthAppSecretsColumns,
		PrimaryKey: []*schema.Column{CfOauthAppSecretsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_oauth_app_secrets_cf_oauth_apps_secrets",
				Columns:    []*schema.Column{CfOauthAppSecretsColumns[8]},
				RefColumns: []*schema.Column{CfOauthAppsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "oauthappsecret_app_id",
				Unique:  false,
				Columns: []*schema.Column{CfOauthAppSecretsColumns[8]},
			},
			{
				Name:    "oauthappsecret_app_id_revoked",
				Unique:  false,
				Columns: []*schema.Column{CfOauthAppSecretsColumns[8], CfOauthAppSecretsColumns[5]},
			},
		},
	}
	// CfOauthAuthCodesColumns holds the columns for the "cf_oauth_auth_codes" table.
	CfOauthAuthCodesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "code_signature", Type: field.TypeString, Unique: true},
		{Name: "code_challenge", Type: field.TypeString, Nullable: true},
		{Name: "code_challenge_method", Type: field.TypeString, Nullable: true, Default: "S256"},
		{Name: "redirect_uri", Type: field.TypeString},
		{Name: "scopes", Type: field.TypeJSON},
		{Name: "state", Type: field.TypeString, Nullable: true},
		{Name: "nonce", Type: field.TypeString, Nullable: true},
		{Name: "request_data", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "expires_at", Type: field.TypeTime},
		{Name: "used", Type: field.TypeBool, Default: false},
		{Name: "used_at", Type: field.TypeTime, Nullable: true},
		{Name: "client_ip", Type: field.TypeString, Nullable: true},
		{Name: "user_agent", Type: field.TypeString, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "app_id", Type: field.TypeUUID},
		{Name: "user_id", Type: field.TypeUUID},
	}
	// CfOauthAuthCodesTable holds the schema information for the "cf_oauth_auth_codes" table.
	CfOauthAuthCodesTable = &schema.Table{
		Name:       "cf_oauth_auth_codes",
		Columns:    CfOauthAuthCodesColumns,
		PrimaryKey: []*schema.Column{CfOauthAuthCodesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_oauth_auth_codes_cf_oauth_apps_auth_codes",
				Columns:    []*schema.Column{CfOauthAuthCodesColumns[15]},
				RefColumns: []*schema.Column{CfOauthAppsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "cf_oauth_auth_codes_cf_users_oauth_auth_codes",
				Columns:    []*schema.Column{CfOauthAuthCodesColumns[16]},
				RefColumns: []*schema.Column{CfUsersColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "oauthauthcode_code_signature",
				Unique:  true,
				Columns: []*schema.Column{CfOauthAuthCodesColumns[1]},
			},
			{
				Name:    "oauthauthcode_app_id",
				Unique:  false,
				Columns: []*schema.Column{CfOauthAuthCodesColumns[15]},
			},
			{
				Name:    "oauthauthcode_user_id",
				Unique:  false,
				Columns: []*schema.Column{CfOauthAuthCodesColumns[16]},
			},
			{
				Name:    "oauthauthcode_expires_at",
				Unique:  false,
				Columns: []*schema.Column{CfOauthAuthCodesColumns[9]},
			},
			{
				Name:    "oauthauthcode_used",
				Unique:  false,
				Columns: []*schema.Column{CfOauthAuthCodesColumns[10]},
			},
		},
	}
	// CfOauthConsentsColumns holds the columns for the "cf_oauth_consents" table.
	CfOauthConsentsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "scopes", Type: field.TypeJSON},
		{Name: "granted", Type: field.TypeBool, Default: true},
		{Name: "granted_at", Type: field.TypeTime},
		{Name: "last_used_at", Type: field.TypeTime, Nullable: true},
		{Name: "revoked", Type: field.TypeBool, Default: false},
		{Name: "revoked_at", Type: field.TypeTime, Nullable: true},
		{Name: "revoked_reason", Type: field.TypeString, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "app_id", Type: field.TypeUUID},
		{Name: "user_id", Type: field.TypeUUID},
	}
	// CfOauthConsentsTable holds the schema information for the "cf_oauth_consents" table.
	CfOauthConsentsTable = &schema.Table{
		Name:       "cf_oauth_consents",
		Columns:    CfOauthConsentsColumns,
		PrimaryKey: []*schema.Column{CfOauthConsentsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_oauth_consents_cf_oauth_apps_consents",
				Columns:    []*schema.Column{CfOauthConsentsColumns[10]},
				RefColumns: []*schema.Column{CfOauthAppsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "cf_oauth_consents_cf_users_oauth_consents",
				Columns:    []*schema.Column{CfOauthConsentsColumns[11]},
				RefColumns: []*schema.Column{CfUsersColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "oauthconsent_user_id_app_id",
				Unique:  true,
				Columns: []*schema.Column{CfOauthConsentsColumns[11], CfOauthConsentsColumns[10]},
			},
			{
				Name:    "oauthconsent_user_id",
				Unique:  false,
				Columns: []*schema.Column{CfOauthConsentsColumns[11]},
			},
			{
				Name:    "oauthconsent_app_id",
				Unique:  false,
				Columns: []*schema.Column{CfOauthConsentsColumns[10]},
			},
			{
				Name:    "oauthconsent_granted",
				Unique:  false,
				Columns: []*schema.Column{CfOauthConsentsColumns[2]},
			},
			{
				Name:    "oauthconsent_revoked",
				Unique:  false,
				Columns: []*schema.Column{CfOauthConsentsColumns[5]},
			},
		},
	}
	// CfOauthTokensColumns holds the columns for the "cf_oauth_tokens" table.
	CfOauthTokensColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "service_account_id", Type: field.TypeUUID, Nullable: true},
		{Name: "access_token_signature", Type: field.TypeString, Unique: true},
		{Name: "refresh_token_signature", Type: field.TypeString, Unique: true, Nullable: true},
		{Name: "family_id", Type: field.TypeUUID},
		{Name: "scopes", Type: field.TypeJSON},
		{Name: "audience", Type: field.TypeJSON},
		{Name: "session_id", Type: field.TypeString, Nullable: true},
		{Name: "request_data", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "access_expires_at", Type: field.TypeTime},
		{Name: "refresh_expires_at", Type: field.TypeTime, Nullable: true},
		{Name: "revoked", Type: field.TypeBool, Default: false},
		{Name: "revoked_at", Type: field.TypeTime, Nullable: true},
		{Name: "revoked_reason", Type: field.TypeString, Nullable: true},
		{Name: "client_ip", Type: field.TypeString, Nullable: true},
		{Name: "user_agent", Type: field.TypeString, Nullable: true},
		{Name: "last_used_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "app_id", Type: field.TypeUUID},
		{Name: "user_id", Type: field.TypeUUID, Nullable: true},
	}
	// CfOauthTokensTable holds the schema information for the "cf_oauth_tokens" table.
	CfOauthTokensTable = &schema.Table{
		Name:       "cf_oauth_tokens",
		Columns:    CfOauthTokensColumns,
		PrimaryKey: []*schema.Column{CfOauthTokensColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_oauth_tokens_cf_oauth_apps_tokens",
				Columns:    []*schema.Column{CfOauthTokensColumns[18]},
				RefColumns: []*schema.Column{CfOauthAppsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "cf_oauth_tokens_cf_users_oauth_tokens",
				Columns:    []*schema.Column{CfOauthTokensColumns[19]},
				RefColumns: []*schema.Column{CfUsersColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "oauthtoken_access_token_signature",
				Unique:  true,
				Columns: []*schema.Column{CfOauthTokensColumns[2]},
			},
			{
				Name:    "oauthtoken_refresh_token_signature",
				Unique:  true,
				Columns: []*schema.Column{CfOauthTokensColumns[3]},
			},
			{
				Name:    "oauthtoken_app_id",
				Unique:  false,
				Columns: []*schema.Column{CfOauthTokensColumns[18]},
			},
			{
				Name:    "oauthtoken_user_id",
				Unique:  false,
				Columns: []*schema.Column{CfOauthTokensColumns[19]},
			},
			{
				Name:    "oauthtoken_family_id",
				Unique:  false,
				Columns: []*schema.Column{CfOauthTokensColumns[4]},
			},
			{
				Name:    "oauthtoken_revoked",
				Unique:  false,
				Columns: []*schema.Column{CfOauthTokensColumns[11]},
			},
			{
				Name:    "oauthtoken_access_expires_at",
				Unique:  false,
				Columns: []*schema.Column{CfOauthTokensColumns[9]},
			},
		},
	}
	// CfOrganizationsColumns holds the columns for the "cf_organizations" table.
	CfOrganizationsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "name", Type: field.TypeString},
		{Name: "slug", Type: field.TypeString, Unique: true},
		{Name: "org_type", Type: field.TypeEnum, Enums: []string{"personal", "team", "enterprise"}, Default: "team"},
		{Name: "logo_url", Type: field.TypeString, Nullable: true},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "website_url", Type: field.TypeString, Nullable: true},
		{Name: "settings", Type: field.TypeJSON, Nullable: true},
		{Name: "plan", Type: field.TypeEnum, Enums: []string{"free", "starter", "pro", "enterprise"}, Default: "free"},
		{Name: "active", Type: field.TypeBool, Default: true},
		{Name: "owner_principal_id", Type: field.TypeUUID, Nullable: true},
	}
	// CfOrganizationsTable holds the schema information for the "cf_organizations" table.
	CfOrganizationsTable = &schema.Table{
		Name:       "cf_organizations",
		Columns:    CfOrganizationsColumns,
		PrimaryKey: []*schema.Column{CfOrganizationsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_organizations_cf_principals_owned_organizations",
				Columns:    []*schema.Column{CfOrganizationsColumns[12]},
				RefColumns: []*schema.Column{CfPrincipalsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "organization_slug",
				Unique:  true,
				Columns: []*schema.Column{CfOrganizationsColumns[4]},
			},
			{
				Name:    "organization_active",
				Unique:  false,
				Columns: []*schema.Column{CfOrganizationsColumns[11]},
			},
			{
				Name:    "organization_org_type",
				Unique:  false,
				Columns: []*schema.Column{CfOrganizationsColumns[5]},
			},
			{
				Name:    "organization_owner_principal_id",
				Unique:  false,
				Columns: []*schema.Column{CfOrganizationsColumns[12]},
			},
			{
				Name:    "organization_org_type_active",
				Unique:  false,
				Columns: []*schema.Column{CfOrganizationsColumns[5], CfOrganizationsColumns[11]},
			},
		},
	}
	// CfPrincipalsColumns holds the columns for the "cf_principals" table.
	CfPrincipalsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "type", Type: field.TypeEnum, Enums: []string{"human", "application", "agent", "service"}},
		{Name: "identifier", Type: field.TypeString, Unique: true},
		{Name: "display_name", Type: field.TypeString},
		{Name: "active", Type: field.TypeBool, Default: true},
		{Name: "capabilities", Type: field.TypeJSON},
		{Name: "allowed_scopes", Type: field.TypeJSON},
		{Name: "metadata", Type: field.TypeJSON, Nullable: true},
		{Name: "organization_id", Type: field.TypeUUID, Nullable: true},
	}
	// CfPrincipalsTable holds the schema information for the "cf_principals" table.
	CfPrincipalsTable = &schema.Table{
		Name:       "cf_principals",
		Columns:    CfPrincipalsColumns,
		PrimaryKey: []*schema.Column{CfPrincipalsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_principals_cf_organizations_principals",
				Columns:    []*schema.Column{CfPrincipalsColumns[10]},
				RefColumns: []*schema.Column{CfOrganizationsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "principal_identifier",
				Unique:  true,
				Columns: []*schema.Column{CfPrincipalsColumns[4]},
			},
			{
				Name:    "principal_type",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalsColumns[3]},
			},
			{
				Name:    "principal_organization_id",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalsColumns[10]},
			},
			{
				Name:    "principal_active",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalsColumns[6]},
			},
			{
				Name:    "principal_type_active",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalsColumns[3], CfPrincipalsColumns[6]},
			},
			{
				Name:    "principal_organization_id_type",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalsColumns[10], CfPrincipalsColumns[3]},
			},
		},
	}
	// CfPrincipalMembershipsColumns holds the columns for the "cf_principal_memberships" table.
	CfPrincipalMembershipsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "role", Type: field.TypeString},
		{Name: "permissions", Type: field.TypeJSON, Nullable: true},
		{Name: "active", Type: field.TypeBool, Default: true},
		{Name: "organization_id", Type: field.TypeUUID},
		{Name: "principal_id", Type: field.TypeUUID},
	}
	// CfPrincipalMembershipsTable holds the schema information for the "cf_principal_memberships" table.
	CfPrincipalMembershipsTable = &schema.Table{
		Name:       "cf_principal_memberships",
		Columns:    CfPrincipalMembershipsColumns,
		PrimaryKey: []*schema.Column{CfPrincipalMembershipsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_principal_memberships_cf_organizations_principal_memberships",
				Columns:    []*schema.Column{CfPrincipalMembershipsColumns[6]},
				RefColumns: []*schema.Column{CfOrganizationsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "cf_principal_memberships_cf_principals_principal_memberships",
				Columns:    []*schema.Column{CfPrincipalMembershipsColumns[7]},
				RefColumns: []*schema.Column{CfPrincipalsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "principalmembership_principal_id_organization_id",
				Unique:  true,
				Columns: []*schema.Column{CfPrincipalMembershipsColumns[7], CfPrincipalMembershipsColumns[6]},
			},
			{
				Name:    "principalmembership_principal_id",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalMembershipsColumns[7]},
			},
			{
				Name:    "principalmembership_organization_id",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalMembershipsColumns[6]},
			},
			{
				Name:    "principalmembership_role",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalMembershipsColumns[3]},
			},
			{
				Name:    "principalmembership_active",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalMembershipsColumns[5]},
			},
		},
	}
	// CfPrincipalTokensColumns holds the columns for the "cf_principal_tokens" table.
	CfPrincipalTokensColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "principal_type", Type: field.TypeEnum, Enums: []string{"human", "application", "agent", "service"}},
		{Name: "access_token_signature", Type: field.TypeString, Unique: true},
		{Name: "refresh_token_signature", Type: field.TypeString, Unique: true, Nullable: true},
		{Name: "family_id", Type: field.TypeUUID},
		{Name: "scopes", Type: field.TypeJSON},
		{Name: "audience", Type: field.TypeJSON},
		{Name: "capabilities", Type: field.TypeJSON},
		{Name: "delegation_chain", Type: field.TypeJSON},
		{Name: "dpop_jkt", Type: field.TypeString, Nullable: true},
		{Name: "session_id", Type: field.TypeString, Nullable: true},
		{Name: "request_data", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "access_expires_at", Type: field.TypeTime},
		{Name: "refresh_expires_at", Type: field.TypeTime, Nullable: true},
		{Name: "revoked", Type: field.TypeBool, Default: false},
		{Name: "revoked_at", Type: field.TypeTime, Nullable: true},
		{Name: "revoked_reason", Type: field.TypeString, Nullable: true},
		{Name: "client_ip", Type: field.TypeString, Nullable: true},
		{Name: "user_agent", Type: field.TypeString, Nullable: true},
		{Name: "last_used_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "issued_by_app_id", Type: field.TypeUUID, Nullable: true},
		{Name: "principal_id", Type: field.TypeUUID},
		{Name: "parent_token_id", Type: field.TypeUUID, Nullable: true},
	}
	// CfPrincipalTokensTable holds the schema information for the "cf_principal_tokens" table.
	CfPrincipalTokensTable = &schema.Table{
		Name:       "cf_principal_tokens",
		Columns:    CfPrincipalTokensColumns,
		PrimaryKey: []*schema.Column{CfPrincipalTokensColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_principal_tokens_cf_applications_issued_tokens",
				Columns:    []*schema.Column{CfPrincipalTokensColumns[21]},
				RefColumns: []*schema.Column{CfApplicationsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "cf_principal_tokens_cf_principals_principal_tokens",
				Columns:    []*schema.Column{CfPrincipalTokensColumns[22]},
				RefColumns: []*schema.Column{CfPrincipalsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "cf_principal_tokens_cf_principal_tokens_child_tokens",
				Columns:    []*schema.Column{CfPrincipalTokensColumns[23]},
				RefColumns: []*schema.Column{CfPrincipalTokensColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "principaltoken_access_token_signature",
				Unique:  true,
				Columns: []*schema.Column{CfPrincipalTokensColumns[2]},
			},
			{
				Name:    "principaltoken_refresh_token_signature",
				Unique:  true,
				Columns: []*schema.Column{CfPrincipalTokensColumns[3]},
			},
			{
				Name:    "principaltoken_principal_id",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalTokensColumns[22]},
			},
			{
				Name:    "principaltoken_principal_type",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalTokensColumns[1]},
			},
			{
				Name:    "principaltoken_issued_by_app_id",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalTokensColumns[21]},
			},
			{
				Name:    "principaltoken_family_id",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalTokensColumns[4]},
			},
			{
				Name:    "principaltoken_parent_token_id",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalTokensColumns[23]},
			},
			{
				Name:    "principaltoken_revoked",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalTokensColumns[14]},
			},
			{
				Name:    "principaltoken_access_expires_at",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalTokensColumns[12]},
			},
			{
				Name:    "principaltoken_session_id",
				Unique:  false,
				Columns: []*schema.Column{CfPrincipalTokensColumns[10]},
			},
		},
	}
	// CfRefreshTokensColumns holds the columns for the "cf_refresh_tokens" table.
	CfRefreshTokensColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "token", Type: field.TypeString, Unique: true},
		{Name: "family", Type: field.TypeString},
		{Name: "expires_at", Type: field.TypeTime},
		{Name: "revoked", Type: field.TypeBool, Default: false},
		{Name: "user_agent", Type: field.TypeString, Nullable: true},
		{Name: "ip_address", Type: field.TypeString, Nullable: true},
		{Name: "user_id", Type: field.TypeUUID},
	}
	// CfRefreshTokensTable holds the schema information for the "cf_refresh_tokens" table.
	CfRefreshTokensTable = &schema.Table{
		Name:       "cf_refresh_tokens",
		Columns:    CfRefreshTokensColumns,
		PrimaryKey: []*schema.Column{CfRefreshTokensColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_refresh_tokens_cf_users_refresh_tokens",
				Columns:    []*schema.Column{CfRefreshTokensColumns[9]},
				RefColumns: []*schema.Column{CfUsersColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "refreshtoken_token",
				Unique:  true,
				Columns: []*schema.Column{CfRefreshTokensColumns[3]},
			},
			{
				Name:    "refreshtoken_user_id",
				Unique:  false,
				Columns: []*schema.Column{CfRefreshTokensColumns[9]},
			},
			{
				Name:    "refreshtoken_family",
				Unique:  false,
				Columns: []*schema.Column{CfRefreshTokensColumns[4]},
			},
			{
				Name:    "refreshtoken_expires_at",
				Unique:  false,
				Columns: []*schema.Column{CfRefreshTokensColumns[5]},
			},
			{
				Name:    "refreshtoken_revoked",
				Unique:  false,
				Columns: []*schema.Column{CfRefreshTokensColumns[6]},
			},
		},
	}
	// CfServiceAccountsColumns holds the columns for the "cf_service_accounts" table.
	CfServiceAccountsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeString, Size: 255},
		{Name: "description", Type: field.TypeString, Nullable: true, Size: 1000},
		{Name: "email", Type: field.TypeString, Unique: true},
		{Name: "allowed_scopes", Type: field.TypeJSON},
		{Name: "active", Type: field.TypeBool, Default: true},
		{Name: "last_used_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "organization_id", Type: field.TypeUUID},
		{Name: "created_by", Type: field.TypeUUID},
	}
	// CfServiceAccountsTable holds the schema information for the "cf_service_accounts" table.
	CfServiceAccountsTable = &schema.Table{
		Name:       "cf_service_accounts",
		Columns:    CfServiceAccountsColumns,
		PrimaryKey: []*schema.Column{CfServiceAccountsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_service_accounts_cf_organizations_service_accounts",
				Columns:    []*schema.Column{CfServiceAccountsColumns[9]},
				RefColumns: []*schema.Column{CfOrganizationsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "cf_service_accounts_cf_users_created_service_accounts",
				Columns:    []*schema.Column{CfServiceAccountsColumns[10]},
				RefColumns: []*schema.Column{CfUsersColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "serviceaccount_email",
				Unique:  true,
				Columns: []*schema.Column{CfServiceAccountsColumns[3]},
			},
			{
				Name:    "serviceaccount_organization_id",
				Unique:  false,
				Columns: []*schema.Column{CfServiceAccountsColumns[9]},
			},
			{
				Name:    "serviceaccount_active",
				Unique:  false,
				Columns: []*schema.Column{CfServiceAccountsColumns[5]},
			},
		},
	}
	// CfServiceAccountKeyPairsColumns holds the columns for the "cf_service_account_key_pairs" table.
	CfServiceAccountKeyPairsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "key_id", Type: field.TypeString},
		{Name: "key_type", Type: field.TypeEnum, Enums: []string{"rsa", "ec"}, Default: "rsa"},
		{Name: "algorithm", Type: field.TypeEnum, Enums: []string{"RS256", "RS384", "RS512", "ES256", "ES384", "ES512"}, Default: "RS256"},
		{Name: "public_key_pem", Type: field.TypeString, Size: 2147483647},
		{Name: "expires_at", Type: field.TypeTime, Nullable: true},
		{Name: "active", Type: field.TypeBool, Default: true},
		{Name: "last_used_at", Type: field.TypeTime, Nullable: true},
		{Name: "revoked", Type: field.TypeBool, Default: false},
		{Name: "revoked_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "service_account_id", Type: field.TypeUUID},
	}
	// CfServiceAccountKeyPairsTable holds the schema information for the "cf_service_account_key_pairs" table.
	CfServiceAccountKeyPairsTable = &schema.Table{
		Name:       "cf_service_account_key_pairs",
		Columns:    CfServiceAccountKeyPairsColumns,
		PrimaryKey: []*schema.Column{CfServiceAccountKeyPairsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_service_account_key_pairs_cf_service_accounts_key_pairs",
				Columns:    []*schema.Column{CfServiceAccountKeyPairsColumns[11]},
				RefColumns: []*schema.Column{CfServiceAccountsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "serviceaccountkeypair_service_account_id_key_id",
				Unique:  true,
				Columns: []*schema.Column{CfServiceAccountKeyPairsColumns[11], CfServiceAccountKeyPairsColumns[1]},
			},
			{
				Name:    "serviceaccountkeypair_service_account_id",
				Unique:  false,
				Columns: []*schema.Column{CfServiceAccountKeyPairsColumns[11]},
			},
			{
				Name:    "serviceaccountkeypair_active",
				Unique:  false,
				Columns: []*schema.Column{CfServiceAccountKeyPairsColumns[6]},
			},
			{
				Name:    "serviceaccountkeypair_revoked",
				Unique:  false,
				Columns: []*schema.Column{CfServiceAccountKeyPairsColumns[8]},
			},
		},
	}
	// CfServicePrincipalsColumns holds the columns for the "cf_service_principals" table.
	CfServicePrincipalsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "service_type", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true, Size: 1000},
		{Name: "last_used_at", Type: field.TypeTime, Nullable: true},
		{Name: "allowed_ips", Type: field.TypeJSON},
		{Name: "principal_id", Type: field.TypeUUID, Unique: true},
		{Name: "created_by", Type: field.TypeUUID, Nullable: true},
	}
	// CfServicePrincipalsTable holds the schema information for the "cf_service_principals" table.
	CfServicePrincipalsTable = &schema.Table{
		Name:       "cf_service_principals",
		Columns:    CfServicePrincipalsColumns,
		PrimaryKey: []*schema.Column{CfServicePrincipalsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cf_service_principals_cf_principals_service_principal",
				Columns:    []*schema.Column{CfServicePrincipalsColumns[7]},
				RefColumns: []*schema.Column{CfPrincipalsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "cf_service_principals_cf_principals_creator",
				Columns:    []*schema.Column{CfServicePrincipalsColumns[8]},
				RefColumns: []*schema.Column{CfPrincipalsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "serviceprincipal_principal_id",
				Unique:  true,
				Columns: []*schema.Column{CfServicePrincipalsColumns[7]},
			},
			{
				Name:    "serviceprincipal_service_type",
				Unique:  false,
				Columns: []*schema.Column{CfServicePrincipalsColumns[3]},
			},
			{
				Name:    "serviceprincipal_created_by",
				Unique:  false,
				Columns: []*schema.Column{CfServicePrincipalsColumns[8]},
			},
		},
	}
	// CfUsersColumns holds the columns for the "cf_users" table.
	CfUsersColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "email", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "avatar_url", Type: field.TypeString, Nullable: true},
		{Name: "password_hash", Type: field.TypeString, Nullable: true},
		{Name: "is_platform_admin", Type: field.TypeBool, Default: false},
		{Name: "active", Type: field.TypeBool, Default: true},
		{Name: "last_login_at", Type: field.TypeTime, Nullable: true},
		{Name: "federation_id", Type: field.TypeUUID, Unique: true, Nullable: true},
	}
	// CfUsersTable holds the schema information for the "cf_users" table.
	CfUsersTable = &schema.Table{
		Name:       "cf_users",
		Columns:    CfUsersColumns,
		PrimaryKey: []*schema.Column{CfUsersColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "user_email",
				Unique:  true,
				Columns: []*schema.Column{CfUsersColumns[3]},
			},
			{
				Name:    "user_active",
				Unique:  false,
				Columns: []*schema.Column{CfUsersColumns[8]},
			},
			{
				Name:    "user_federation_id",
				Unique:  true,
				Columns: []*schema.Column{CfUsersColumns[10]},
			},
		},
	}
	// Tables holds all the tables in the schema.
	Tables = []*schema.Table{
		CfAPIKeysTable,
		CfAgentsTable,
		CfApplicationsTable,
		CfCredentialsTable,
		CfHumansTable,
		CfInvitesTable,
		CfMembershipsTable,
		CfOauthAccountsTable,
		CfOauthAppsTable,
		CfOauthAppSecretsTable,
		CfOauthAuthCodesTable,
		CfOauthConsentsTable,
		CfOauthTokensTable,
		CfOrganizationsTable,
		CfPrincipalsTable,
		CfPrincipalMembershipsTable,
		CfPrincipalTokensTable,
		CfRefreshTokensTable,
		CfServiceAccountsTable,
		CfServiceAccountKeyPairsTable,
		CfServicePrincipalsTable,
		CfUsersTable,
	}
)

Functions

func Create

func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...schema.MigrateOption) error

Create creates all table resources using the given schema driver.

Types

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

Schema is the API for creating, migrating and dropping a schema.

func NewSchema

func NewSchema(drv dialect.Driver) *Schema

NewSchema creates a new schema client.

func (*Schema) Create

func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error

Create creates all schema resources.

func (*Schema) WriteTo

func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error

WriteTo writes the schema changes to w instead of running them against the database.

if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
	log.Fatal(err)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL