Help us shape the future of Go! Take the 2026 Go Developer Survey

migrate

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: AGPL-3.0 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 (
	// APITokensColumns holds the columns for the "api_tokens" table.
	APITokensColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "name", Type: field.TypeString},
		{Name: "prefix", Type: field.TypeString, Unique: true},
		{Name: "secret_hash", Type: field.TypeString},
		{Name: "scopes", Type: field.TypeJSON},
		{Name: "expires_at", Type: field.TypeTime, Nullable: true},
		{Name: "revoked_at", Type: field.TypeTime, Nullable: true},
		{Name: "last_used_at", Type: field.TypeTime, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// APITokensTable holds the schema information for the "api_tokens" table.
	APITokensTable = &schema.Table{
		Name:       "api_tokens",
		Columns:    APITokensColumns,
		PrimaryKey: []*schema.Column{APITokensColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "api_tokens_workspaces_api_tokens",
				Columns:    []*schema.Column{APITokensColumns[10]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "apitoken_workspace_id",
				Unique:  false,
				Columns: []*schema.Column{APITokensColumns[10]},
			},
		},
	}
	// AuditEntriesColumns holds the columns for the "audit_entries" table.
	AuditEntriesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "entry_key", Type: field.TypeString},
		{Name: "occurred_at", Type: field.TypeTime},
		{Name: "actor_kind", Type: field.TypeString},
		{Name: "actor_id", Type: field.TypeString, Nullable: true},
		{Name: "actor_name", Type: field.TypeString, Nullable: true},
		{Name: "action", Type: field.TypeString},
		{Name: "target_type", Type: field.TypeString},
		{Name: "target_id", Type: field.TypeString, Nullable: true},
		{Name: "target_name", Type: field.TypeString, Nullable: true},
		{Name: "diff", Type: field.TypeJSON, Nullable: true},
		{Name: "request_id", Type: field.TypeString, Nullable: true},
		{Name: "ip", Type: field.TypeString, Nullable: true},
		{Name: "user_agent", Type: field.TypeString, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// AuditEntriesTable holds the schema information for the "audit_entries" table.
	AuditEntriesTable = &schema.Table{
		Name:       "audit_entries",
		Columns:    AuditEntriesColumns,
		PrimaryKey: []*schema.Column{AuditEntriesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "audit_entries_workspaces_audit_entries",
				Columns:    []*schema.Column{AuditEntriesColumns[16]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "audit_entries_workspace_id_entry_key",
				Unique:  true,
				Columns: []*schema.Column{AuditEntriesColumns[16], AuditEntriesColumns[3]},
			},
			{
				Name:    "auditentry_workspace_id_id",
				Unique:  false,
				Columns: []*schema.Column{AuditEntriesColumns[16], AuditEntriesColumns[0]},
			},
			{
				Name:    "auditentry_workspace_id_updated_at_id",
				Unique:  false,
				Columns: []*schema.Column{AuditEntriesColumns[16], AuditEntriesColumns[2], AuditEntriesColumns[0]},
			},
		},
	}
	// AuthAttemptsColumns holds the columns for the "auth_attempts" table.
	AuthAttemptsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "email", Type: field.TypeString},
		{Name: "kind", Type: field.TypeEnum, Enums: []string{"login", "staff_login", "password_reset", "register", "email_change", "test_send_user", "test_send_workspace"}},
		{Name: "failures", Type: field.TypeInt, Default: 0},
		{Name: "last_attempt_at", Type: field.TypeTime},
	}
	// AuthAttemptsTable holds the schema information for the "auth_attempts" table.
	AuthAttemptsTable = &schema.Table{
		Name:       "auth_attempts",
		Columns:    AuthAttemptsColumns,
		PrimaryKey: []*schema.Column{AuthAttemptsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "authattempt_email_kind",
				Unique:  true,
				Columns: []*schema.Column{AuthAttemptsColumns[3], AuthAttemptsColumns[4]},
			},
			{
				Name:    "authattempt_last_attempt_at",
				Unique:  false,
				Columns: []*schema.Column{AuthAttemptsColumns[6]},
			},
		},
	}
	// AutomationsColumns holds the columns for the "automations" table.
	AutomationsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "discarded_at", Type: field.TypeTime, Nullable: true},
		{Name: "name", Type: field.TypeString},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"draft", "active"}, Default: "draft"},
		{Name: "trigger_event", Type: field.TypeString},
		{Name: "integration_id", Type: field.TypeInt64, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// AutomationsTable holds the schema information for the "automations" table.
	AutomationsTable = &schema.Table{
		Name:       "automations",
		Columns:    AutomationsColumns,
		PrimaryKey: []*schema.Column{AutomationsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "automations_integrations_integration",
				Columns:    []*schema.Column{AutomationsColumns[7]},
				RefColumns: []*schema.Column{IntegrationsColumns[0]},
				OnDelete:   schema.Restrict,
			},
			{
				Symbol:     "automations_workspaces_automations",
				Columns:    []*schema.Column{AutomationsColumns[8]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "automation_workspace_id_status_trigger_event",
				Unique:  false,
				Columns: []*schema.Column{AutomationsColumns[8], AutomationsColumns[5], AutomationsColumns[6]},
			},
			{
				Name:    "automation_integration_id",
				Unique:  false,
				Columns: []*schema.Column{AutomationsColumns[7]},
			},
		},
	}
	// AutomationRunsColumns holds the columns for the "automation_runs" table.
	AutomationRunsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"active", "completed", "failed", "exited"}, Default: "active"},
		{Name: "current_step", Type: field.TypeInt, Default: 0},
		{Name: "resume_at", Type: field.TypeTime, Nullable: true},
		{Name: "failure_kind", Type: field.TypeEnum, Nullable: true, Enums: []string{"invalid_body", "timeout", "blocked_address", "http_status", "network"}},
		{Name: "failure_status", Type: field.TypeInt, Nullable: true},
		{Name: "failure_excerpt", Type: field.TypeString, Nullable: true},
		{Name: "automation_id", Type: field.TypeInt64},
		{Name: "contact_id", Type: field.TypeInt64},
		{Name: "version_id", Type: field.TypeInt64},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// AutomationRunsTable holds the schema information for the "automation_runs" table.
	AutomationRunsTable = &schema.Table{
		Name:       "automation_runs",
		Columns:    AutomationRunsColumns,
		PrimaryKey: []*schema.Column{AutomationRunsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "automation_runs_automations_runs",
				Columns:    []*schema.Column{AutomationRunsColumns[9]},
				RefColumns: []*schema.Column{AutomationsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "automation_runs_contacts_contact",
				Columns:    []*schema.Column{AutomationRunsColumns[10]},
				RefColumns: []*schema.Column{ContactsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "automation_runs_automation_versions_runs",
				Columns:    []*schema.Column{AutomationRunsColumns[11]},
				RefColumns: []*schema.Column{AutomationVersionsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "automation_runs_workspaces_automation_runs",
				Columns:    []*schema.Column{AutomationRunsColumns[12]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "automation_runs_automation_id_contact_id",
				Unique:  true,
				Columns: []*schema.Column{AutomationRunsColumns[9], AutomationRunsColumns[10]},
			},
			{
				Name:    "automationrun_workspace_id_contact_id",
				Unique:  false,
				Columns: []*schema.Column{AutomationRunsColumns[12], AutomationRunsColumns[10]},
			},
			{
				Name:    "automation_runs_contact_id",
				Unique:  false,
				Columns: []*schema.Column{AutomationRunsColumns[10]},
			},
			{
				Name:    "automationrun_version_id",
				Unique:  false,
				Columns: []*schema.Column{AutomationRunsColumns[11]},
			},
		},
	}
	// AutomationVersionsColumns holds the columns for the "automation_versions" table.
	AutomationVersionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "version", Type: field.TypeInt},
		{Name: "steps", Type: field.TypeString, Default: "[]"},
		{Name: "automation_id", Type: field.TypeInt64},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// AutomationVersionsTable holds the schema information for the "automation_versions" table.
	AutomationVersionsTable = &schema.Table{
		Name:       "automation_versions",
		Columns:    AutomationVersionsColumns,
		PrimaryKey: []*schema.Column{AutomationVersionsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "automation_versions_automations_versions",
				Columns:    []*schema.Column{AutomationVersionsColumns[5]},
				RefColumns: []*schema.Column{AutomationsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "automation_versions_workspaces_automation_versions",
				Columns:    []*schema.Column{AutomationVersionsColumns[6]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "automation_versions_workspace_id_automation_id_version",
				Unique:  true,
				Columns: []*schema.Column{AutomationVersionsColumns[6], AutomationVersionsColumns[5], AutomationVersionsColumns[3]},
			},
			{
				Name:    "automationversion_automation_id",
				Unique:  false,
				Columns: []*schema.Column{AutomationVersionsColumns[5]},
			},
		},
	}
	// BrandKitsColumns holds the columns for the "brand_kits" table.
	BrandKitsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "accent_color", Type: field.TypeString},
		{Name: "text_color", Type: field.TypeString},
		{Name: "background_color", Type: field.TypeString},
		{Name: "heading_font", Type: field.TypeString},
		{Name: "body_font", Type: field.TypeString},
		{Name: "logo_url", Type: field.TypeString, Default: ""},
		{Name: "button_text_color", Type: field.TypeString},
		{Name: "button_radius", Type: field.TypeInt},
		{Name: "footer_text", Type: field.TypeString, Default: ""},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// BrandKitsTable holds the schema information for the "brand_kits" table.
	BrandKitsTable = &schema.Table{
		Name:       "brand_kits",
		Columns:    BrandKitsColumns,
		PrimaryKey: []*schema.Column{BrandKitsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "brand_kits_workspaces_brand_kits",
				Columns:    []*schema.Column{BrandKitsColumns[12]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "brandkit_workspace_id",
				Unique:  true,
				Columns: []*schema.Column{BrandKitsColumns[12]},
			},
		},
	}
	// BroadcastsColumns holds the columns for the "broadcasts" table.
	BroadcastsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "discarded_at", Type: field.TypeTime, Nullable: true},
		{Name: "name", Type: field.TypeString},
		{Name: "subject", Type: field.TypeString, Default: ""},
		{Name: "from_name", Type: field.TypeString, Nullable: true},
		{Name: "from_email", Type: field.TypeString, Nullable: true},
		{Name: "body", Type: field.TypeString, Default: ""},
		{Name: "doc", Type: field.TypeJSON, Nullable: true},
		{Name: "editor_version", Type: field.TypeString, Nullable: true},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"draft", "scheduled", "sending", "sent", "failed"}, Default: "draft"},
		{Name: "scheduled_at", Type: field.TypeTime, Nullable: true},
		{Name: "sent_at", Type: field.TypeTime, Nullable: true},
		{Name: "hold_reason", Type: field.TypeString, Nullable: true},
		{Name: "last_scheduled_at", Type: field.TypeTime, Nullable: true},
		{Name: "segment_id", Type: field.TypeInt64, Nullable: true},
		{Name: "integration_id", Type: field.TypeInt64, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// BroadcastsTable holds the schema information for the "broadcasts" table.
	BroadcastsTable = &schema.Table{
		Name:       "broadcasts",
		Columns:    BroadcastsColumns,
		PrimaryKey: []*schema.Column{BroadcastsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "broadcasts_segments_segment",
				Columns:    []*schema.Column{BroadcastsColumns[16]},
				RefColumns: []*schema.Column{SegmentsColumns[0]},
				OnDelete:   schema.Restrict,
			},
			{
				Symbol:     "broadcasts_integrations_integration",
				Columns:    []*schema.Column{BroadcastsColumns[17]},
				RefColumns: []*schema.Column{IntegrationsColumns[0]},
				OnDelete:   schema.Restrict,
			},
			{
				Symbol:     "broadcasts_workspaces_broadcasts",
				Columns:    []*schema.Column{BroadcastsColumns[18]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "broadcast_workspace_id",
				Unique:  false,
				Columns: []*schema.Column{BroadcastsColumns[18]},
			},
			{
				Name:    "broadcast_segment_id",
				Unique:  false,
				Columns: []*schema.Column{BroadcastsColumns[16]},
			},
			{
				Name:    "broadcast_integration_id",
				Unique:  false,
				Columns: []*schema.Column{BroadcastsColumns[17]},
			},
		},
	}
	// BroadcastRecipientsColumns holds the columns for the "broadcast_recipients" table.
	BroadcastRecipientsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "deferred_until", Type: field.TypeTime, Nullable: true},
		{Name: "opened_at", Type: field.TypeTime, Nullable: true},
		{Name: "clicked_at", Type: field.TypeTime, Nullable: true},
		{Name: "unsubscribed_at", Type: field.TypeTime, Nullable: true},
		{Name: "broadcast_id", Type: field.TypeInt64},
		{Name: "contact_id", Type: field.TypeInt64, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// BroadcastRecipientsTable holds the schema information for the "broadcast_recipients" table.
	BroadcastRecipientsTable = &schema.Table{
		Name:       "broadcast_recipients",
		Columns:    BroadcastRecipientsColumns,
		PrimaryKey: []*schema.Column{BroadcastRecipientsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "broadcast_recipients_broadcasts_recipients",
				Columns:    []*schema.Column{BroadcastRecipientsColumns[7]},
				RefColumns: []*schema.Column{BroadcastsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "broadcast_recipients_contacts_contact",
				Columns:    []*schema.Column{BroadcastRecipientsColumns[8]},
				RefColumns: []*schema.Column{ContactsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "broadcast_recipients_workspaces_broadcast_recipients",
				Columns:    []*schema.Column{BroadcastRecipientsColumns[9]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "broadcast_recipients_broadcast_id_contact_id",
				Unique:  true,
				Columns: []*schema.Column{BroadcastRecipientsColumns[7], BroadcastRecipientsColumns[8]},
			},
			{
				Name:    "broadcastrecipient_workspace_id",
				Unique:  false,
				Columns: []*schema.Column{BroadcastRecipientsColumns[9]},
			},
			{
				Name:    "broadcast_recipients_contact_id",
				Unique:  false,
				Columns: []*schema.Column{BroadcastRecipientsColumns[8]},
			},
		},
	}
	// CapturedMessagesColumns holds the columns for the "captured_messages" table.
	CapturedMessagesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "surface", Type: field.TypeEnum, Enums: []string{"broadcast", "automation", "transactional", "test"}},
		{Name: "sending_source", Type: field.TypeString, Nullable: true},
		{Name: "recipient", Type: field.TypeString},
		{Name: "from_email", Type: field.TypeString},
		{Name: "from_name", Type: field.TypeString, Nullable: true},
		{Name: "subject", Type: field.TypeString},
		{Name: "html", Type: field.TypeString, Size: 2147483647},
		{Name: "text", Type: field.TypeString, Size: 2147483647},
		{Name: "headers", Type: field.TypeJSON},
		{Name: "links", Type: field.TypeJSON},
		{Name: "from_unverified", Type: field.TypeBool, Default: false},
		{Name: "outbound_message_id", Type: field.TypeInt64, Nullable: true},
		{Name: "integration_id", Type: field.TypeInt64},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// CapturedMessagesTable holds the schema information for the "captured_messages" table.
	CapturedMessagesTable = &schema.Table{
		Name:       "captured_messages",
		Columns:    CapturedMessagesColumns,
		PrimaryKey: []*schema.Column{CapturedMessagesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "captured_messages_outbound_messages_outbound_message",
				Columns:    []*schema.Column{CapturedMessagesColumns[14]},
				RefColumns: []*schema.Column{OutboundMessagesColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "captured_messages_integrations_captured_messages",
				Columns:    []*schema.Column{CapturedMessagesColumns[15]},
				RefColumns: []*schema.Column{IntegrationsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "captured_messages_workspaces_captured_messages",
				Columns:    []*schema.Column{CapturedMessagesColumns[16]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "capturedmessage_workspace_id_created_at_id",
				Unique:  false,
				Columns: []*schema.Column{CapturedMessagesColumns[16], CapturedMessagesColumns[1], CapturedMessagesColumns[0]},
			},
			{
				Name:    "capturedmessage_workspace_id_recipient",
				Unique:  false,
				Columns: []*schema.Column{CapturedMessagesColumns[16], CapturedMessagesColumns[5]},
			},
			{
				Name:    "captured_messages_integration_id",
				Unique:  false,
				Columns: []*schema.Column{CapturedMessagesColumns[15]},
			},
			{
				Name:    "captured_messages_outbound_message_id",
				Unique:  false,
				Columns: []*schema.Column{CapturedMessagesColumns[14]},
			},
		},
	}
	// ConfirmationsColumns holds the columns for the "confirmations" table.
	ConfirmationsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "channel", Type: field.TypeEnum, Enums: []string{"email"}, Default: "email"},
		{Name: "destination", Type: field.TypeString},
		{Name: "provenance", Type: field.TypeEnum, Enums: []string{"double_opt_in", "grandfathered", "imported"}},
		{Name: "contact_id", Type: field.TypeInt64, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// ConfirmationsTable holds the schema information for the "confirmations" table.
	ConfirmationsTable = &schema.Table{
		Name:       "confirmations",
		Columns:    ConfirmationsColumns,
		PrimaryKey: []*schema.Column{ConfirmationsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "confirmations_contacts_contact",
				Columns:    []*schema.Column{ConfirmationsColumns[6]},
				RefColumns: []*schema.Column{ContactsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "confirmations_workspaces_confirmations",
				Columns:    []*schema.Column{ConfirmationsColumns[7]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "confirmations_ws_channel_dest",
				Unique:  true,
				Columns: []*schema.Column{ConfirmationsColumns[7], ConfirmationsColumns[3], ConfirmationsColumns[4]},
			},
			{
				Name:    "confirmations_contact_id",
				Unique:  false,
				Columns: []*schema.Column{ConfirmationsColumns[6]},
			},
		},
	}
	// ContactsColumns holds the columns for the "contacts" table.
	ContactsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "subject_id", Type: field.TypeString, Nullable: true},
		{Name: "email", Type: field.TypeString, Nullable: true},
		{Name: "phone", Type: field.TypeString, Nullable: true},
		{Name: "first_name", Type: field.TypeString, Nullable: true},
		{Name: "last_name", Type: field.TypeString, Nullable: true},
		{Name: "time_zone", Type: field.TypeString, Nullable: true},
		{Name: "source", Type: field.TypeEnum, Nullable: true, Enums: []string{"manual", "api", "tracker"}},
		{Name: "custom_fields", Type: field.TypeJSON, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// ContactsTable holds the schema information for the "contacts" table.
	ContactsTable = &schema.Table{
		Name:       "contacts",
		Columns:    ContactsColumns,
		PrimaryKey: []*schema.Column{ContactsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "contacts_workspaces_contacts",
				Columns:    []*schema.Column{ContactsColumns[11]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "contacts_email_workspace_id",
				Unique:  true,
				Columns: []*schema.Column{ContactsColumns[4], ContactsColumns[11]},
			},
			{
				Name:    "contacts_subject_id_workspace_id",
				Unique:  true,
				Columns: []*schema.Column{ContactsColumns[3], ContactsColumns[11]},
			},
			{
				Name:    "contacts_phone_workspace_id",
				Unique:  true,
				Columns: []*schema.Column{ContactsColumns[5], ContactsColumns[11]},
			},
			{
				Name:    "contact_workspace_id_updated_at_id",
				Unique:  false,
				Columns: []*schema.Column{ContactsColumns[11], ContactsColumns[2], ContactsColumns[0]},
			},
			{
				Name:    "contacts_workspace_id_identified",
				Unique:  false,
				Columns: []*schema.Column{ContactsColumns[11]},
				Annotation: &entsql.IndexAnnotation{
					Where: "email IS NOT NULL AND email <> ''",
				},
			},
		},
	}
	// ContactTagsColumns holds the columns for the "contact_tags" table.
	ContactTagsColumns = []*schema.Column{
		{Name: "contact_id", Type: field.TypeInt64},
		{Name: "tag_id", Type: field.TypeInt64},
	}
	// ContactTagsTable holds the schema information for the "contact_tags" table.
	ContactTagsTable = &schema.Table{
		Name:       "contact_tags",
		Columns:    ContactTagsColumns,
		PrimaryKey: []*schema.Column{ContactTagsColumns[0], ContactTagsColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "contact_tags_contact_id",
				Columns:    []*schema.Column{ContactTagsColumns[0]},
				RefColumns: []*schema.Column{ContactsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "contact_tags_tag_id",
				Columns:    []*schema.Column{ContactTagsColumns[1]},
				RefColumns: []*schema.Column{TagsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "contacttag_tag_id",
				Unique:  false,
				Columns: []*schema.Column{ContactTagsColumns[1]},
			},
		},
	}
	// CustomFieldsColumns holds the columns for the "custom_fields" table.
	CustomFieldsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "key", Type: field.TypeString},
		{Name: "name", Type: field.TypeString},
		{Name: "type", Type: field.TypeEnum, Enums: []string{"string", "number", "bool", "datetime"}, Default: "string"},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// CustomFieldsTable holds the schema information for the "custom_fields" table.
	CustomFieldsTable = &schema.Table{
		Name:       "custom_fields",
		Columns:    CustomFieldsColumns,
		PrimaryKey: []*schema.Column{CustomFieldsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "custom_fields_workspaces_custom_fields",
				Columns:    []*schema.Column{CustomFieldsColumns[6]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "custom_fields_workspace_id_key",
				Unique:  true,
				Columns: []*schema.Column{CustomFieldsColumns[6], CustomFieldsColumns[3]},
			},
		},
	}
	// EmailTemplatesColumns holds the columns for the "email_templates" table.
	EmailTemplatesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "name", Type: field.TypeString},
		{Name: "subject", Type: field.TypeString, Default: ""},
		{Name: "body", Type: field.TypeString, Default: ""},
		{Name: "doc", Type: field.TypeJSON, Nullable: true},
		{Name: "editor_version", Type: field.TypeString, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// EmailTemplatesTable holds the schema information for the "email_templates" table.
	EmailTemplatesTable = &schema.Table{
		Name:       "email_templates",
		Columns:    EmailTemplatesColumns,
		PrimaryKey: []*schema.Column{EmailTemplatesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "email_templates_workspaces_email_templates",
				Columns:    []*schema.Column{EmailTemplatesColumns[8]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "emailtemplate_workspace_id",
				Unique:  false,
				Columns: []*schema.Column{EmailTemplatesColumns[8]},
			},
		},
	}
	// ErasuresColumns holds the columns for the "erasures" table.
	ErasuresColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "erasure_key", Type: field.TypeString},
		{Name: "contact_id", Type: field.TypeInt64, Nullable: true},
		{Name: "subject_id", Type: field.TypeString, Default: ""},
		{Name: "visitor_ids", Type: field.TypeJSON},
		{Name: "email_sha256", Type: field.TypeString, Nullable: true},
		{Name: "phone_sha256", Type: field.TypeString, Nullable: true},
		{Name: "erased_at", Type: field.TypeTime},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// ErasuresTable holds the schema information for the "erasures" table.
	ErasuresTable = &schema.Table{
		Name:       "erasures",
		Columns:    ErasuresColumns,
		PrimaryKey: []*schema.Column{ErasuresColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "erasures_workspaces_erasures",
				Columns:    []*schema.Column{ErasuresColumns[10]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "erasures_workspace_id_erasure_key",
				Unique:  true,
				Columns: []*schema.Column{ErasuresColumns[10], ErasuresColumns[3]},
			},
			{
				Name:    "erasure_workspace_id_updated_at_id",
				Unique:  false,
				Columns: []*schema.Column{ErasuresColumns[10], ErasuresColumns[2], ErasuresColumns[0]},
			},
			{
				Name:    "erasure_erased_at",
				Unique:  false,
				Columns: []*schema.Column{ErasuresColumns[9]},
			},
		},
	}
	// EventsColumns holds the columns for the "events" table.
	EventsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "source_id", Type: field.TypeString, Unique: true, Nullable: true},
		{Name: "visitor_id", Type: field.TypeString, Nullable: true},
		{Name: "subject_id", Type: field.TypeString, Nullable: true},
		{Name: "email", Type: field.TypeString, Nullable: true},
		{Name: "phone", Type: field.TypeString, Nullable: true},
		{Name: "action", Type: field.TypeString},
		{Name: "properties", Type: field.TypeJSON, Nullable: true},
		{Name: "occurred_at", Type: field.TypeTime, Nullable: true},
		{Name: "backfill", Type: field.TypeBool, Default: false},
		{Name: "contact_id", Type: field.TypeInt64, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// EventsTable holds the schema information for the "events" table.
	EventsTable = &schema.Table{
		Name:       "events",
		Columns:    EventsColumns,
		PrimaryKey: []*schema.Column{EventsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "events_contacts_events",
				Columns:    []*schema.Column{EventsColumns[12]},
				RefColumns: []*schema.Column{ContactsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "events_workspaces_events",
				Columns:    []*schema.Column{EventsColumns[13]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "event_workspace_id_contact_id_action",
				Unique:  false,
				Columns: []*schema.Column{EventsColumns[13], EventsColumns[12], EventsColumns[8]},
			},
			{
				Name:    "event_workspace_id_visitor_id",
				Unique:  false,
				Columns: []*schema.Column{EventsColumns[13], EventsColumns[4]},
			},
			{
				Name:    "event_contact_id",
				Unique:  false,
				Columns: []*schema.Column{EventsColumns[12]},
			},
			{
				Name:    "event_workspace_id_updated_at_id",
				Unique:  false,
				Columns: []*schema.Column{EventsColumns[13], EventsColumns[2], EventsColumns[0]},
			},
			{
				Name:    "events_created_at_analytical_idx",
				Unique:  false,
				Columns: []*schema.Column{EventsColumns[1]},
				Annotation: &entsql.IndexAnnotation{
					Where: "action NOT IN ('marketing.confirmed', 'email.complained', 'email.unsubscribed') AND NOT (action = 'email.bounced' AND COALESCE(properties->>'bounceKind', '') = 'permanent')",
				},
			},
		},
	}
	// HoldsColumns holds the columns for the "holds" table.
	HoldsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "key", Type: field.TypeString},
		{Name: "reason_code", Type: field.TypeString},
		{Name: "message", Type: field.TypeString},
		{Name: "action_url", Type: field.TypeString, Nullable: true},
		{Name: "expires_at", Type: field.TypeTime},
		{Name: "set_by", Type: field.TypeString},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// HoldsTable holds the schema information for the "holds" table.
	HoldsTable = &schema.Table{
		Name:       "holds",
		Columns:    HoldsColumns,
		PrimaryKey: []*schema.Column{HoldsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "holds_workspaces_holds",
				Columns:    []*schema.Column{HoldsColumns[9]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "holds_workspace_id_key",
				Unique:  true,
				Columns: []*schema.Column{HoldsColumns[9], HoldsColumns[3]},
			},
		},
	}
	// InstanceStateColumns holds the columns for the "instance_state" table.
	InstanceStateColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "instance_id", Type: field.TypeString},
		{Name: "telemetry_enabled", Type: field.TypeBool, Default: true},
		{Name: "notice_acknowledged_at", Type: field.TypeTime, Nullable: true},
		{Name: "last_report_sent_at", Type: field.TypeTime, Nullable: true},
		{Name: "latest_release", Type: field.TypeString, Nullable: true},
		{Name: "latest_release_checked_at", Type: field.TypeTime, Nullable: true},
	}
	// InstanceStateTable holds the schema information for the "instance_state" table.
	InstanceStateTable = &schema.Table{
		Name:       "instance_state",
		Columns:    InstanceStateColumns,
		PrimaryKey: []*schema.Column{InstanceStateColumns[0]},
	}
	// IntegrationsColumns holds the columns for the "integrations" table.
	IntegrationsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "discarded_at", Type: field.TypeTime, Nullable: true},
		{Name: "name", Type: field.TypeString},
		{Name: "channel", Type: field.TypeEnum, Enums: []string{"email", "sms"}, Default: "email"},
		{Name: "provider", Type: field.TypeEnum, Enums: []string{"smtp", "ses", "inbox"}},
		{Name: "config_encrypted", Type: field.TypeString},
		{Name: "preset", Type: field.TypeString, Nullable: true},
		{Name: "params_encrypted", Type: field.TypeString, Nullable: true},
		{Name: "ingest_key", Type: field.TypeString, Unique: true},
		{Name: "enabled", Type: field.TypeBool, Default: true},
		{Name: "is_default", Type: field.TypeBool, Default: false},
		{Name: "max_per_second", Type: field.TypeInt, Nullable: true},
		{Name: "max_per_day", Type: field.TypeInt, Nullable: true},
		{Name: "provider_max_per_second", Type: field.TypeInt, Nullable: true},
		{Name: "provider_max_per_day", Type: field.TypeInt, Nullable: true},
		{Name: "provider_quota_checked_at", Type: field.TypeTime, Nullable: true},
		{Name: "provider_quota_failed_at", Type: field.TypeTime, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// IntegrationsTable holds the schema information for the "integrations" table.
	IntegrationsTable = &schema.Table{
		Name:       "integrations",
		Columns:    IntegrationsColumns,
		PrimaryKey: []*schema.Column{IntegrationsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "integrations_workspaces_integrations",
				Columns:    []*schema.Column{IntegrationsColumns[19]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "integration_workspace_id_channel",
				Unique:  true,
				Columns: []*schema.Column{IntegrationsColumns[19], IntegrationsColumns[5]},
				Annotation: &entsql.IndexAnnotation{
					Where: "is_default AND discarded_at IS NULL",
				},
			},
			{
				Name:    "integration_workspace_id",
				Unique:  false,
				Columns: []*schema.Column{IntegrationsColumns[19]},
			},
			{
				Name:    "integrations_one_inbox_per_workspace",
				Unique:  true,
				Columns: []*schema.Column{IntegrationsColumns[19], IntegrationsColumns[6]},
				Annotation: &entsql.IndexAnnotation{
					Where: "provider = 'inbox' AND discarded_at IS NULL",
				},
			},
		},
	}
	// InvitationsColumns holds the columns for the "invitations" table.
	InvitationsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "email", Type: field.TypeString},
		{Name: "role", Type: field.TypeEnum, Enums: []string{"admin", "member"}},
		{Name: "token_hash", Type: field.TypeString},
		{Name: "expires_at", Type: field.TypeTime},
		{Name: "accepted_at", Type: field.TypeTime, Nullable: true},
		{Name: "invited_by", Type: field.TypeInt64, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// InvitationsTable holds the schema information for the "invitations" table.
	InvitationsTable = &schema.Table{
		Name:       "invitations",
		Columns:    InvitationsColumns,
		PrimaryKey: []*schema.Column{InvitationsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "invitations_users_sent_invitations",
				Columns:    []*schema.Column{InvitationsColumns[8]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "invitations_workspaces_invitations",
				Columns:    []*schema.Column{InvitationsColumns[9]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "invitation_workspace_id_email",
				Unique:  true,
				Columns: []*schema.Column{InvitationsColumns[9], InvitationsColumns[3]},
			},
			{
				Name:    "invitation_invited_by",
				Unique:  false,
				Columns: []*schema.Column{InvitationsColumns[8]},
			},
		},
	}
	// JoinDomainsColumns holds the columns for the "join_domains" table.
	JoinDomainsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "domain", Type: field.TypeString},
		{Name: "token", Type: field.TypeString},
		{Name: "verified_at", Type: field.TypeTime, Nullable: true},
		{Name: "last_checked_at", Type: field.TypeTime, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// JoinDomainsTable holds the schema information for the "join_domains" table.
	JoinDomainsTable = &schema.Table{
		Name:       "join_domains",
		Columns:    JoinDomainsColumns,
		PrimaryKey: []*schema.Column{JoinDomainsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "join_domains_workspaces_join_domains",
				Columns:    []*schema.Column{JoinDomainsColumns[7]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "joindomain_workspace_id_domain",
				Unique:  true,
				Columns: []*schema.Column{JoinDomainsColumns[7], JoinDomainsColumns[3]},
			},
			{
				Name:    "joindomain_domain",
				Unique:  true,
				Columns: []*schema.Column{JoinDomainsColumns[3]},
				Annotation: &entsql.IndexAnnotation{
					Where: "verified_at IS NOT NULL",
				},
			},
			{
				Name:    "joindomain_last_checked_at",
				Unique:  false,
				Columns: []*schema.Column{JoinDomainsColumns[6]},
			},
		},
	}
	// MembershipsColumns holds the columns for the "memberships" table.
	MembershipsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "role", Type: field.TypeEnum, Enums: []string{"owner", "admin", "member"}},
		{Name: "source", Type: field.TypeEnum, Nullable: true, Enums: []string{"creator", "invitation", "domain"}},
		{Name: "second_factor_reminded_at", Type: field.TypeTime, Nullable: true},
		{Name: "user_id", Type: field.TypeInt64},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// MembershipsTable holds the schema information for the "memberships" table.
	MembershipsTable = &schema.Table{
		Name:       "memberships",
		Columns:    MembershipsColumns,
		PrimaryKey: []*schema.Column{MembershipsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "memberships_users_memberships",
				Columns:    []*schema.Column{MembershipsColumns[6]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "memberships_workspaces_memberships",
				Columns:    []*schema.Column{MembershipsColumns[7]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "membership_user_id_workspace_id",
				Unique:  true,
				Columns: []*schema.Column{MembershipsColumns[6], MembershipsColumns[7]},
			},
			{
				Name:    "membership_workspace_id",
				Unique:  false,
				Columns: []*schema.Column{MembershipsColumns[7]},
			},
		},
	}
	// OauthClientsColumns holds the columns for the "oauth_clients" table.
	OauthClientsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "client_id", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "redirect_uris", Type: field.TypeJSON},
		{Name: "metadata_expires_at", Type: field.TypeTime, Nullable: true},
	}
	// OauthClientsTable holds the schema information for the "oauth_clients" table.
	OauthClientsTable = &schema.Table{
		Name:       "oauth_clients",
		Columns:    OauthClientsColumns,
		PrimaryKey: []*schema.Column{OauthClientsColumns[0]},
	}
	// OauthCodesColumns holds the columns for the "oauth_codes" table.
	OauthCodesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "code_hash", Type: field.TypeString, Unique: true},
		{Name: "redirect_uri", Type: field.TypeString},
		{Name: "code_challenge", Type: field.TypeString},
		{Name: "scopes", Type: field.TypeJSON},
		{Name: "expires_at", Type: field.TypeTime},
		{Name: "used_at", Type: field.TypeTime, Nullable: true},
		{Name: "client_id", Type: field.TypeInt64},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// OauthCodesTable holds the schema information for the "oauth_codes" table.
	OauthCodesTable = &schema.Table{
		Name:       "oauth_codes",
		Columns:    OauthCodesColumns,
		PrimaryKey: []*schema.Column{OauthCodesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "oauth_codes_oauth_clients_codes",
				Columns:    []*schema.Column{OauthCodesColumns[9]},
				RefColumns: []*schema.Column{OauthClientsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "oauth_codes_workspaces_workspace",
				Columns:    []*schema.Column{OauthCodesColumns[10]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "oauthcode_client_id",
				Unique:  false,
				Columns: []*schema.Column{OauthCodesColumns[9]},
			},
			{
				Name:    "oauthcode_workspace_id",
				Unique:  false,
				Columns: []*schema.Column{OauthCodesColumns[10]},
			},
		},
	}
	// OauthRefreshTokensColumns holds the columns for the "oauth_refresh_tokens" table.
	OauthRefreshTokensColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "token_hash", Type: field.TypeString, Unique: true},
		{Name: "expires_at", Type: field.TypeTime},
		{Name: "used_at", Type: field.TypeTime, Nullable: true},
		{Name: "client_id", Type: field.TypeInt64},
		{Name: "api_token_id", Type: field.TypeInt64},
	}
	// OauthRefreshTokensTable holds the schema information for the "oauth_refresh_tokens" table.
	OauthRefreshTokensTable = &schema.Table{
		Name:       "oauth_refresh_tokens",
		Columns:    OauthRefreshTokensColumns,
		PrimaryKey: []*schema.Column{OauthRefreshTokensColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "oauth_refresh_tokens_oauth_clients_refresh_tokens",
				Columns:    []*schema.Column{OauthRefreshTokensColumns[6]},
				RefColumns: []*schema.Column{OauthClientsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "oauth_refresh_tokens_api_tokens_api_token",
				Columns:    []*schema.Column{OauthRefreshTokensColumns[7]},
				RefColumns: []*schema.Column{APITokensColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "oauthrefreshtoken_api_token_id",
				Unique:  false,
				Columns: []*schema.Column{OauthRefreshTokensColumns[7]},
			},
			{
				Name:    "oauthrefreshtoken_client_id",
				Unique:  false,
				Columns: []*schema.Column{OauthRefreshTokensColumns[6]},
			},
		},
	}
	// OutboundMessagesColumns holds the columns for the "outbound_messages" table.
	OutboundMessagesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "kind", Type: field.TypeEnum, Enums: []string{"broadcast", "automation", "transactional"}},
		{Name: "idempotency_key", Type: field.TypeString},
		{Name: "channel", Type: field.TypeEnum, Enums: []string{"email"}, Default: "email"},
		{Name: "destination", Type: field.TypeString, Nullable: true},
		{Name: "sending_source", Type: field.TypeString, Nullable: true},
		{Name: "sending_domain", Type: field.TypeString, Nullable: true},
		{Name: "provider_message_id", Type: field.TypeString, Nullable: true},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"pending", "sent", "skipped", "failed"}, Default: "pending"},
		{Name: "reason", Type: field.TypeString, Nullable: true},
		{Name: "claimed_at", Type: field.TypeTime},
		{Name: "sent_at", Type: field.TypeTime, Nullable: true},
		{Name: "delivered_at", Type: field.TypeTime, Nullable: true},
		{Name: "bounced_at", Type: field.TypeTime, Nullable: true},
		{Name: "complained_at", Type: field.TypeTime, Nullable: true},
		{Name: "captured", Type: field.TypeBool, Default: false},
		{Name: "automation_step", Type: field.TypeInt, Nullable: true},
		{Name: "app_origin", Type: field.TypeString, Nullable: true},
		{Name: "broadcast_id", Type: field.TypeInt64, Nullable: true},
		{Name: "automation_id", Type: field.TypeInt64, Nullable: true},
		{Name: "integration_id", Type: field.TypeInt64, Nullable: true},
		{Name: "broadcast_recipient_id", Type: field.TypeInt64, Nullable: true},
		{Name: "automation_run_id", Type: field.TypeInt64, Nullable: true},
		{Name: "contact_id", Type: field.TypeInt64, Nullable: true},
		{Name: "template_id", Type: field.TypeInt64, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// OutboundMessagesTable holds the schema information for the "outbound_messages" table.
	OutboundMessagesTable = &schema.Table{
		Name:       "outbound_messages",
		Columns:    OutboundMessagesColumns,
		PrimaryKey: []*schema.Column{OutboundMessagesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "outbound_messages_broadcasts_broadcast",
				Columns:    []*schema.Column{OutboundMessagesColumns[20]},
				RefColumns: []*schema.Column{BroadcastsColumns[0]},
				OnDelete:   schema.Restrict,
			},
			{
				Symbol:     "outbound_messages_automations_automation",
				Columns:    []*schema.Column{OutboundMessagesColumns[21]},
				RefColumns: []*schema.Column{AutomationsColumns[0]},
				OnDelete:   schema.Restrict,
			},
			{
				Symbol:     "outbound_messages_integrations_integration",
				Columns:    []*schema.Column{OutboundMessagesColumns[22]},
				RefColumns: []*schema.Column{IntegrationsColumns[0]},
				OnDelete:   schema.Restrict,
			},
			{
				Symbol:     "outbound_messages_broadcast_recipients_broadcast_recipient",
				Columns:    []*schema.Column{OutboundMessagesColumns[23]},
				RefColumns: []*schema.Column{BroadcastRecipientsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "outbound_messages_automation_runs_automation_run",
				Columns:    []*schema.Column{OutboundMessagesColumns[24]},
				RefColumns: []*schema.Column{AutomationRunsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "outbound_messages_contacts_contact",
				Columns:    []*schema.Column{OutboundMessagesColumns[25]},
				RefColumns: []*schema.Column{ContactsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "outbound_messages_email_templates_template",
				Columns:    []*schema.Column{OutboundMessagesColumns[26]},
				RefColumns: []*schema.Column{EmailTemplatesColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "outbound_messages_workspaces_outbound_messages",
				Columns:    []*schema.Column{OutboundMessagesColumns[27]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "outbound_messages_workspace_id_idempotency_key",
				Unique:  true,
				Columns: []*schema.Column{OutboundMessagesColumns[27], OutboundMessagesColumns[4]},
			},
			{
				Name:    "outboundmessage_workspace_id_kind_created_at",
				Unique:  false,
				Columns: []*schema.Column{OutboundMessagesColumns[27], OutboundMessagesColumns[3], OutboundMessagesColumns[1]},
			},
			{
				Name:    "outboundmessage_workspace_id_integration_id_sent_at",
				Unique:  false,
				Columns: []*schema.Column{OutboundMessagesColumns[27], OutboundMessagesColumns[22], OutboundMessagesColumns[13]},
			},
			{
				Name:    "outboundmessage_workspace_id_sending_domain_created_at",
				Unique:  false,
				Columns: []*schema.Column{OutboundMessagesColumns[27], OutboundMessagesColumns[8], OutboundMessagesColumns[1]},
			},
			{
				Name:    "outbound_messages_workspace_id_provider_message_id",
				Unique:  false,
				Columns: []*schema.Column{OutboundMessagesColumns[27], OutboundMessagesColumns[9]},
			},
			{
				Name:    "outboundmessage_workspace_id_updated_at_id",
				Unique:  false,
				Columns: []*schema.Column{OutboundMessagesColumns[27], OutboundMessagesColumns[2], OutboundMessagesColumns[0]},
			},
			{
				Name:    "outbound_messages_contact_id",
				Unique:  false,
				Columns: []*schema.Column{OutboundMessagesColumns[25]},
			},
			{
				Name:    "outboundmessage_workspace_id_broadcast_id_status",
				Unique:  false,
				Columns: []*schema.Column{OutboundMessagesColumns[27], OutboundMessagesColumns[20], OutboundMessagesColumns[10]},
			},
			{
				Name:    "outbound_messages_broadcast_recipient_id",
				Unique:  false,
				Columns: []*schema.Column{OutboundMessagesColumns[23]},
			},
			{
				Name:    "outbound_messages_broadcast_id",
				Unique:  false,
				Columns: []*schema.Column{OutboundMessagesColumns[20]},
			},
			{
				Name:    "outbound_messages_integration_id",
				Unique:  false,
				Columns: []*schema.Column{OutboundMessagesColumns[22]},
			},
			{
				Name:    "outbound_messages_automation_id",
				Unique:  false,
				Columns: []*schema.Column{OutboundMessagesColumns[21]},
			},
			{
				Name:    "outbound_messages_automation_run_id",
				Unique:  false,
				Columns: []*schema.Column{OutboundMessagesColumns[24]},
			},
			{
				Name:    "outbound_messages_template_id",
				Unique:  false,
				Columns: []*schema.Column{OutboundMessagesColumns[26]},
			},
			{
				Name:    "outbound_messages_workspace_id_sent_at_broadcast",
				Unique:  false,
				Columns: []*schema.Column{OutboundMessagesColumns[27], OutboundMessagesColumns[13]},
				Annotation: &entsql.IndexAnnotation{
					Where: "broadcast_recipient_id IS NOT NULL",
				},
			},
		},
	}
	// PasskeysColumns holds the columns for the "passkeys" table.
	PasskeysColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "credential_id", Type: field.TypeBytes, Unique: true},
		{Name: "public_key", Type: field.TypeBytes},
		{Name: "sign_count", Type: field.TypeInt64, Default: 0},
		{Name: "transports", Type: field.TypeJSON, Nullable: true},
		{Name: "backup_eligible", Type: field.TypeBool},
		{Name: "backup_state", Type: field.TypeBool},
		{Name: "aaguid", Type: field.TypeBytes, Nullable: true},
		{Name: "attestation_type", Type: field.TypeString, Nullable: true},
		{Name: "name", Type: field.TypeString},
		{Name: "last_used_at", Type: field.TypeTime, Nullable: true},
		{Name: "user_id", Type: field.TypeInt64},
	}
	// PasskeysTable holds the schema information for the "passkeys" table.
	PasskeysTable = &schema.Table{
		Name:       "passkeys",
		Columns:    PasskeysColumns,
		PrimaryKey: []*schema.Column{PasskeysColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "passkeys_users_passkeys",
				Columns:    []*schema.Column{PasskeysColumns[13]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "passkey_user_id",
				Unique:  false,
				Columns: []*schema.Column{PasskeysColumns[13]},
			},
		},
	}
	// PasskeyChallengesColumns holds the columns for the "passkey_challenges" table.
	PasskeyChallengesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "challenge", Type: field.TypeString, Unique: true},
	}
	// PasskeyChallengesTable holds the schema information for the "passkey_challenges" table.
	PasskeyChallengesTable = &schema.Table{
		Name:       "passkey_challenges",
		Columns:    PasskeyChallengesColumns,
		PrimaryKey: []*schema.Column{PasskeyChallengesColumns[0]},
	}
	// PrivateRelayRangesColumns holds the columns for the "private_relay_ranges" table.
	PrivateRelayRangesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "cidr", Type: field.TypeString, Unique: true},
	}
	// PrivateRelayRangesTable holds the schema information for the "private_relay_ranges" table.
	PrivateRelayRangesTable = &schema.Table{
		Name:       "private_relay_ranges",
		Columns:    PrivateRelayRangesColumns,
		PrimaryKey: []*schema.Column{PrivateRelayRangesColumns[0]},
	}
	// RecoveryCodesColumns holds the columns for the "recovery_codes" table.
	RecoveryCodesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "code_hash", Type: field.TypeString},
		{Name: "used_at", Type: field.TypeTime, Nullable: true},
		{Name: "user_id", Type: field.TypeInt64},
	}
	// RecoveryCodesTable holds the schema information for the "recovery_codes" table.
	RecoveryCodesTable = &schema.Table{
		Name:       "recovery_codes",
		Columns:    RecoveryCodesColumns,
		PrimaryKey: []*schema.Column{RecoveryCodesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "recovery_codes_users_recovery_codes",
				Columns:    []*schema.Column{RecoveryCodesColumns[5]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "recoverycode_user_id_code_hash",
				Unique:  true,
				Columns: []*schema.Column{RecoveryCodesColumns[5], RecoveryCodesColumns[3]},
			},
		},
	}
	// RulesColumns holds the columns for the "rules" table.
	RulesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "discarded_at", Type: field.TypeTime, Nullable: true},
		{Name: "name", Type: field.TypeString},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"draft", "active"}, Default: "draft"},
		{Name: "activated_at", Type: field.TypeTime, Nullable: true},
		{Name: "condition", Type: field.TypeString, Nullable: true},
		{Name: "actions", Type: field.TypeString, Default: "[]"},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// RulesTable holds the schema information for the "rules" table.
	RulesTable = &schema.Table{
		Name:       "rules",
		Columns:    RulesColumns,
		PrimaryKey: []*schema.Column{RulesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "rules_workspaces_rules",
				Columns:    []*schema.Column{RulesColumns[9]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "rule_workspace_id",
				Unique:  false,
				Columns: []*schema.Column{RulesColumns[9]},
			},
		},
	}
	// RuleFiringsColumns holds the columns for the "rule_firings" table.
	RuleFiringsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "action", Type: field.TypeString},
		{Name: "source_id", Type: field.TypeString},
		{Name: "actions", Type: field.TypeString, Default: "[]"},
		{Name: "properties", Type: field.TypeString, Nullable: true},
		{Name: "results", Type: field.TypeString, Default: "[]"},
		{Name: "completed_at", Type: field.TypeTime, Nullable: true},
		{Name: "rule_id", Type: field.TypeInt64},
		{Name: "contact_id", Type: field.TypeInt64},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// RuleFiringsTable holds the schema information for the "rule_firings" table.
	RuleFiringsTable = &schema.Table{
		Name:       "rule_firings",
		Columns:    RuleFiringsColumns,
		PrimaryKey: []*schema.Column{RuleFiringsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "rule_firings_rules_firings",
				Columns:    []*schema.Column{RuleFiringsColumns[9]},
				RefColumns: []*schema.Column{RulesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "rule_firings_contacts_contact",
				Columns:    []*schema.Column{RuleFiringsColumns[10]},
				RefColumns: []*schema.Column{ContactsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "rule_firings_workspaces_rule_firings",
				Columns:    []*schema.Column{RuleFiringsColumns[11]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "rulefiring_rule_id_source_id",
				Unique:  true,
				Columns: []*schema.Column{RuleFiringsColumns[9], RuleFiringsColumns[4]},
			},
			{
				Name:    "rulefiring_workspace_id",
				Unique:  false,
				Columns: []*schema.Column{RuleFiringsColumns[11]},
			},
			{
				Name:    "rule_firings_contact_id",
				Unique:  false,
				Columns: []*schema.Column{RuleFiringsColumns[10]},
			},
			{
				Name:    "rulefiring_created_at",
				Unique:  false,
				Columns: []*schema.Column{RuleFiringsColumns[1]},
			},
		},
	}
	// RuleTriggersColumns holds the columns for the "rule_triggers" table.
	RuleTriggersColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "action", Type: field.TypeString},
		{Name: "rule_id", Type: field.TypeInt64},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// RuleTriggersTable holds the schema information for the "rule_triggers" table.
	RuleTriggersTable = &schema.Table{
		Name:       "rule_triggers",
		Columns:    RuleTriggersColumns,
		PrimaryKey: []*schema.Column{RuleTriggersColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "rule_triggers_rules_triggers",
				Columns:    []*schema.Column{RuleTriggersColumns[4]},
				RefColumns: []*schema.Column{RulesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "rule_triggers_workspaces_rule_triggers",
				Columns:    []*schema.Column{RuleTriggersColumns[5]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "ruletrigger_workspace_id_action",
				Unique:  false,
				Columns: []*schema.Column{RuleTriggersColumns[5], RuleTriggersColumns[3]},
			},
			{
				Name:    "ruletrigger_rule_id_action",
				Unique:  true,
				Columns: []*schema.Column{RuleTriggersColumns[4], RuleTriggersColumns[3]},
			},
		},
	}
	// SchemaStateColumns holds the columns for the "schema_state" table.
	SchemaStateColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "major", Type: field.TypeInt},
		{Name: "floor", Type: field.TypeString},
	}
	// SchemaStateTable holds the schema information for the "schema_state" table.
	SchemaStateTable = &schema.Table{
		Name:       "schema_state",
		Columns:    SchemaStateColumns,
		PrimaryKey: []*schema.Column{SchemaStateColumns[0]},
	}
	// SegmentsColumns holds the columns for the "segments" table.
	SegmentsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "discarded_at", Type: field.TypeTime, Nullable: true},
		{Name: "name", Type: field.TypeString},
		{Name: "condition", Type: field.TypeString, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// SegmentsTable holds the schema information for the "segments" table.
	SegmentsTable = &schema.Table{
		Name:       "segments",
		Columns:    SegmentsColumns,
		PrimaryKey: []*schema.Column{SegmentsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "segments_workspaces_segments",
				Columns:    []*schema.Column{SegmentsColumns[6]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "segment_workspace_id",
				Unique:  false,
				Columns: []*schema.Column{SegmentsColumns[6]},
			},
		},
	}
	// SendLimitersColumns holds the columns for the "send_limiters" table.
	SendLimitersColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "second_fill", Type: field.TypeFloat64},
		{Name: "day_fill", Type: field.TypeFloat64},
		{Name: "refilled_at", Type: field.TypeTime},
		{Name: "integration_id", Type: field.TypeInt64, Unique: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// SendLimitersTable holds the schema information for the "send_limiters" table.
	SendLimitersTable = &schema.Table{
		Name:       "send_limiters",
		Columns:    SendLimitersColumns,
		PrimaryKey: []*schema.Column{SendLimitersColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "send_limiters_integrations_send_limiter",
				Columns:    []*schema.Column{SendLimitersColumns[6]},
				RefColumns: []*schema.Column{IntegrationsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "send_limiters_workspaces_send_limiters",
				Columns:    []*schema.Column{SendLimitersColumns[7]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "sendlimiter_workspace_id",
				Unique:  false,
				Columns: []*schema.Column{SendLimitersColumns[7]},
			},
		},
	}
	// SendingDomainsColumns holds the columns for the "sending_domains" table.
	SendingDomainsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "discarded_at", Type: field.TypeTime, Nullable: true},
		{Name: "domain", Type: field.TypeString},
		{Name: "dkim_selector", Type: field.TypeString},
		{Name: "dkim_private_key_encrypted", Type: field.TypeString},
		{Name: "dkim_public_key", Type: field.TypeString},
		{Name: "last_checked_at", Type: field.TypeTime, Nullable: true},
		{Name: "verified_at", Type: field.TypeTime, Nullable: true},
		{Name: "verification_lost_at", Type: field.TypeTime, Nullable: true},
		{Name: "tracking_state", Type: field.TypeEnum, Enums: []string{"pending", "dns_verified", "serving"}, Default: "pending"},
		{Name: "tracking_checked_at", Type: field.TypeTime, Nullable: true},
		{Name: "tracking_reason", Type: field.TypeEnum, Nullable: true, Enums: []string{"host_taken"}},
		{Name: "tracking_state_changed_at", Type: field.TypeTime, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// SendingDomainsTable holds the schema information for the "sending_domains" table.
	SendingDomainsTable = &schema.Table{
		Name:       "sending_domains",
		Columns:    SendingDomainsColumns,
		PrimaryKey: []*schema.Column{SendingDomainsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "sending_domains_workspaces_sending_domains",
				Columns:    []*schema.Column{SendingDomainsColumns[15]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "sendingdomain_workspace_id_domain",
				Unique:  true,
				Columns: []*schema.Column{SendingDomainsColumns[15], SendingDomainsColumns[4]},
				Annotation: &entsql.IndexAnnotation{
					Where: "discarded_at IS NULL",
				},
			},
			{
				Name:    "sendingdomain_workspace_id",
				Unique:  false,
				Columns: []*schema.Column{SendingDomainsColumns[15]},
			},
			{
				Name:    "sendingdomain_domain",
				Unique:  true,
				Columns: []*schema.Column{SendingDomainsColumns[4]},
				Annotation: &entsql.IndexAnnotation{
					Where: "tracking_state IN ('dns_verified', 'serving') AND discarded_at IS NULL",
				},
			},
			{
				Name:    "sendingdomain_last_checked_at",
				Unique:  false,
				Columns: []*schema.Column{SendingDomainsColumns[8]},
			},
		},
	}
	// ServiceCredentialsColumns holds the columns for the "service_credentials" table.
	ServiceCredentialsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "name", Type: field.TypeString},
		{Name: "prefix", Type: field.TypeString, Unique: true},
		{Name: "secret_hash", Type: field.TypeString},
		{Name: "scopes", Type: field.TypeJSON},
		{Name: "expires_at", Type: field.TypeTime, Nullable: true},
		{Name: "revoked_at", Type: field.TypeTime, Nullable: true},
		{Name: "last_used_at", Type: field.TypeTime, Nullable: true},
	}
	// ServiceCredentialsTable holds the schema information for the "service_credentials" table.
	ServiceCredentialsTable = &schema.Table{
		Name:       "service_credentials",
		Columns:    ServiceCredentialsColumns,
		PrimaryKey: []*schema.Column{ServiceCredentialsColumns[0]},
	}
	// SignupSurveyResponsesColumns holds the columns for the "signup_survey_responses" table.
	SignupSurveyResponsesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "role", Type: field.TypeEnum, Enums: []string{"founder", "marketer", "developer", "product", "other"}},
		{Name: "role_other_text", Type: field.TypeString, Nullable: true, Size: 100, SchemaType: map[string]string{"postgres": "varchar(100)"}},
		{Name: "company_size", Type: field.TypeEnum, Enums: []string{"1", "2_10", "11_50", "51_200", "201_1000", "1000_plus", "other"}},
		{Name: "company_size_other_text", Type: field.TypeString, Nullable: true, Size: 100, SchemaType: map[string]string{"postgres": "varchar(100)"}},
		{Name: "main_goal", Type: field.TypeEnum, Enums: []string{"broadcasts", "automations", "tracking", "migrating", "other"}},
		{Name: "main_goal_other_text", Type: field.TypeString, Nullable: true, Size: 100, SchemaType: map[string]string{"postgres": "varchar(100)"}},
		{Name: "heard_from", Type: field.TypeEnum, Nullable: true, Enums: []string{"search", "github", "social", "recommendation", "other"}},
		{Name: "heard_from_other_text", Type: field.TypeString, Nullable: true, Size: 100, SchemaType: map[string]string{"postgres": "varchar(100)"}},
		{Name: "user_id", Type: field.TypeInt64, Unique: true},
	}
	// SignupSurveyResponsesTable holds the schema information for the "signup_survey_responses" table.
	SignupSurveyResponsesTable = &schema.Table{
		Name:       "signup_survey_responses",
		Columns:    SignupSurveyResponsesColumns,
		PrimaryKey: []*schema.Column{SignupSurveyResponsesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "signup_survey_responses_users_signup_survey_response",
				Columns:    []*schema.Column{SignupSurveyResponsesColumns[11]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// StaffMembersColumns holds the columns for the "staff_members" table.
	StaffMembersColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "email", Type: field.TypeString, Unique: true},
		{Name: "password_hash", Type: field.TypeString},
		{Name: "totp_secret_encrypted", Type: field.TypeString, Nullable: true},
		{Name: "totp_confirmed_at", Type: field.TypeTime, Nullable: true},
		{Name: "totp_last_step", Type: field.TypeInt64, Default: 0},
		{Name: "session_epoch", Type: field.TypeInt64, Default: 0},
	}
	// StaffMembersTable holds the schema information for the "staff_members" table.
	StaffMembersTable = &schema.Table{
		Name:       "staff_members",
		Columns:    StaffMembersColumns,
		PrimaryKey: []*schema.Column{StaffMembersColumns[0]},
	}
	// SuppressionsColumns holds the columns for the "suppressions" table.
	SuppressionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "channel", Type: field.TypeEnum, Enums: []string{"email"}, Default: "email"},
		{Name: "destination", Type: field.TypeString},
		{Name: "reason", Type: field.TypeEnum, Enums: []string{"bounce", "complaint", "manual"}, Default: "manual"},
		{Name: "lifted_at", Type: field.TypeTime, Nullable: true},
		{Name: "contact_id", Type: field.TypeInt64, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// SuppressionsTable holds the schema information for the "suppressions" table.
	SuppressionsTable = &schema.Table{
		Name:       "suppressions",
		Columns:    SuppressionsColumns,
		PrimaryKey: []*schema.Column{SuppressionsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "suppressions_contacts_contact",
				Columns:    []*schema.Column{SuppressionsColumns[7]},
				RefColumns: []*schema.Column{ContactsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "suppressions_workspaces_suppressions",
				Columns:    []*schema.Column{SuppressionsColumns[8]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "suppressions_workspace_id_channel_destination",
				Unique:  true,
				Columns: []*schema.Column{SuppressionsColumns[8], SuppressionsColumns[3], SuppressionsColumns[4]},
				Annotation: &entsql.IndexAnnotation{
					Where: "lifted_at IS NULL",
				},
			},
			{
				Name:    "suppressions_workspace_id_contact_id",
				Unique:  false,
				Columns: []*schema.Column{SuppressionsColumns[8], SuppressionsColumns[7]},
			},
			{
				Name:    "suppressions_contact_id",
				Unique:  false,
				Columns: []*schema.Column{SuppressionsColumns[7]},
			},
		},
	}
	// TagsColumns holds the columns for the "tags" table.
	TagsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "name", Type: field.TypeString},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// TagsTable holds the schema information for the "tags" table.
	TagsTable = &schema.Table{
		Name:       "tags",
		Columns:    TagsColumns,
		PrimaryKey: []*schema.Column{TagsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "tags_workspaces_tags",
				Columns:    []*schema.Column{TagsColumns[4]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "tags_workspace_id_name",
				Unique:  true,
				Columns: []*schema.Column{TagsColumns[4], TagsColumns[3]},
			},
		},
	}
	// TrackingHostChangesColumns holds the columns for the "tracking_host_changes" table.
	TrackingHostChangesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "workspace_id", Type: field.TypeInt64},
		{Name: "domain", Type: field.TypeString},
		{Name: "state", Type: field.TypeEnum, Enums: []string{"dns_verified", "serving", "removed"}},
	}
	// TrackingHostChangesTable holds the schema information for the "tracking_host_changes" table.
	TrackingHostChangesTable = &schema.Table{
		Name:       "tracking_host_changes",
		Columns:    TrackingHostChangesColumns,
		PrimaryKey: []*schema.Column{TrackingHostChangesColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "trackinghostchange_domain",
				Unique:  false,
				Columns: []*schema.Column{TrackingHostChangesColumns[4]},
			},
		},
	}
	// UnsubscribesColumns holds the columns for the "unsubscribes" table.
	UnsubscribesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "channel", Type: field.TypeEnum, Enums: []string{"email"}, Default: "email"},
		{Name: "destination", Type: field.TypeString},
		{Name: "sending_source", Type: field.TypeString},
		{Name: "contact_id", Type: field.TypeInt64, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// UnsubscribesTable holds the schema information for the "unsubscribes" table.
	UnsubscribesTable = &schema.Table{
		Name:       "unsubscribes",
		Columns:    UnsubscribesColumns,
		PrimaryKey: []*schema.Column{UnsubscribesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "unsubscribes_contacts_contact",
				Columns:    []*schema.Column{UnsubscribesColumns[6]},
				RefColumns: []*schema.Column{ContactsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "unsubscribes_workspaces_unsubscribes",
				Columns:    []*schema.Column{UnsubscribesColumns[7]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "unsubscribes_ws_channel_dest_source",
				Unique:  true,
				Columns: []*schema.Column{UnsubscribesColumns[7], UnsubscribesColumns[3], UnsubscribesColumns[4], UnsubscribesColumns[5]},
			},
			{
				Name:    "unsubscribes_contact_id",
				Unique:  false,
				Columns: []*schema.Column{UnsubscribesColumns[6]},
			},
		},
	}
	// UsagesColumns holds the columns for the "usages" table.
	UsagesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "period_start", Type: field.TypeTime},
		{Name: "metric", Type: field.TypeString},
		{Name: "value", Type: field.TypeInt64, Default: 0},
		{Name: "finalized_at", Type: field.TypeTime, Nullable: true},
		{Name: "computed_at", Type: field.TypeTime},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// UsagesTable holds the schema information for the "usages" table.
	UsagesTable = &schema.Table{
		Name:       "usages",
		Columns:    UsagesColumns,
		PrimaryKey: []*schema.Column{UsagesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "usages_workspaces_usages",
				Columns:    []*schema.Column{UsagesColumns[8]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "usage_workspace_id_period_start_metric",
				Unique:  true,
				Columns: []*schema.Column{UsagesColumns[8], UsagesColumns[3], UsagesColumns[4]},
			},
			{
				Name:    "usage_period_start_workspace_id",
				Unique:  false,
				Columns: []*schema.Column{UsagesColumns[3], UsagesColumns[8]},
			},
		},
	}
	// UsersColumns holds the columns for the "users" table.
	UsersColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "name", Type: field.TypeString},
		{Name: "email", Type: field.TypeString, Unique: true},
		{Name: "password_hash", Type: field.TypeString, Nullable: true},
		{Name: "email_verified_at", Type: field.TypeTime, Nullable: true},
		{Name: "email_proven_at", Type: field.TypeTime, Nullable: true},
		{Name: "session_epoch", Type: field.TypeInt64, Default: 0},
		{Name: "second_factor_secret_encrypted", Type: field.TypeString, Nullable: true},
		{Name: "second_factor_confirmed_at", Type: field.TypeTime, Nullable: true},
		{Name: "second_factor_last_step", Type: field.TypeInt64, Default: 0},
		{Name: "signup_survey_due_at", Type: field.TypeTime, Nullable: true},
	}
	// UsersTable holds the schema information for the "users" table.
	UsersTable = &schema.Table{
		Name:       "users",
		Columns:    UsersColumns,
		PrimaryKey: []*schema.Column{UsersColumns[0]},
	}
	// UserIdentitiesColumns holds the columns for the "user_identities" table.
	UserIdentitiesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "provider", Type: field.TypeString},
		{Name: "subject", Type: field.TypeString},
		{Name: "user_id", Type: field.TypeInt64},
	}
	// UserIdentitiesTable holds the schema information for the "user_identities" table.
	UserIdentitiesTable = &schema.Table{
		Name:       "user_identities",
		Columns:    UserIdentitiesColumns,
		PrimaryKey: []*schema.Column{UserIdentitiesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "user_identities_users_identities",
				Columns:    []*schema.Column{UserIdentitiesColumns[5]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "useridentity_provider_subject",
				Unique:  true,
				Columns: []*schema.Column{UserIdentitiesColumns[3], UserIdentitiesColumns[4]},
			},
			{
				Name:    "useridentity_user_id",
				Unique:  false,
				Columns: []*schema.Column{UserIdentitiesColumns[5]},
			},
		},
	}
	// VisitorsColumns holds the columns for the "visitors" table.
	VisitorsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "visitor_id", Type: field.TypeString},
		{Name: "last_seen_at", Type: field.TypeTime},
		{Name: "contact_id", Type: field.TypeInt64, Nullable: true},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// VisitorsTable holds the schema information for the "visitors" table.
	VisitorsTable = &schema.Table{
		Name:       "visitors",
		Columns:    VisitorsColumns,
		PrimaryKey: []*schema.Column{VisitorsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "visitors_contacts_visitors",
				Columns:    []*schema.Column{VisitorsColumns[5]},
				RefColumns: []*schema.Column{ContactsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "visitors_workspaces_visitors",
				Columns:    []*schema.Column{VisitorsColumns[6]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "visitors_workspace_id_visitor_id",
				Unique:  true,
				Columns: []*schema.Column{VisitorsColumns[6], VisitorsColumns[3]},
			},
			{
				Name:    "visitor_contact_id",
				Unique:  false,
				Columns: []*schema.Column{VisitorsColumns[5]},
			},
		},
	}
	// WebhookEndpointsColumns holds the columns for the "webhook_endpoints" table.
	WebhookEndpointsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "url", Type: field.TypeString},
		{Name: "secret_encrypted", Type: field.TypeString},
		{Name: "event_types", Type: field.TypeJSON, Nullable: true},
		{Name: "disabled_at", Type: field.TypeTime, Nullable: true},
		{Name: "consecutive_failures", Type: field.TypeInt, Nullable: true},
		{Name: "failing_since", Type: field.TypeTime, Nullable: true},
		{Name: "last_error_kind", Type: field.TypeEnum, Nullable: true, Enums: []string{"timeout", "blocked_address", "http_status", "network"}},
		{Name: "last_error_status", Type: field.TypeInt, Nullable: true},
		{Name: "last_failure_at", Type: field.TypeTime, Nullable: true},
		{Name: "disabled_reason", Type: field.TypeEnum, Nullable: true, Enums: []string{"owner", "gone", "persistent_failure"}},
		{Name: "workspace_id", Type: field.TypeInt64},
	}
	// WebhookEndpointsTable holds the schema information for the "webhook_endpoints" table.
	WebhookEndpointsTable = &schema.Table{
		Name:       "webhook_endpoints",
		Columns:    WebhookEndpointsColumns,
		PrimaryKey: []*schema.Column{WebhookEndpointsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "webhook_endpoints_workspaces_webhook_endpoints",
				Columns:    []*schema.Column{WebhookEndpointsColumns[13]},
				RefColumns: []*schema.Column{WorkspacesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "webhookendpoint_workspace_id_disabled_at",
				Unique:  false,
				Columns: []*schema.Column{WebhookEndpointsColumns[13], WebhookEndpointsColumns[6]},
			},
		},
	}
	// WorkspacesColumns holds the columns for the "workspaces" table.
	WorkspacesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "updated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
		{Name: "discarded_at", Type: field.TypeTime, Nullable: true},
		{Name: "name", Type: field.TypeString},
		{Name: "public_id", Type: field.TypeString, Unique: true, Size: 8},
		{Name: "collect_key", Type: field.TypeString, Unique: true},
		{Name: "require_confirmed_opt_in", Type: field.TypeBool, Default: false},
		{Name: "postal_address", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "retention_days", Type: field.TypeInt, Nullable: true},
		{Name: "timezone", Type: field.TypeString, Nullable: true},
		{Name: "domain_join_enabled", Type: field.TypeBool, Default: false},
		{Name: "second_factor_required_at", Type: field.TypeTime, Nullable: true},
		{Name: "feed_position", Type: field.TypeInt64, Default: 0},
		{Name: "erased_at", Type: field.TypeTime, Nullable: true},
		{Name: "suspended_at", Type: field.TypeTime, Nullable: true},
		{Name: "suspended_by_kind", Type: field.TypeEnum, Nullable: true, Enums: []string{"system", "cli", "staff"}},
		{Name: "suspended_by_id", Type: field.TypeString, Nullable: true},
		{Name: "suspension_reason", Type: field.TypeString, Nullable: true},
		{Name: "cleared_at", Type: field.TypeTime, Nullable: true},
		{Name: "abuse_exempt", Type: field.TypeBool, Default: false},
		{Name: "abuse_warning_notified_at", Type: field.TypeTime, Nullable: true},
		{Name: "abuse_freeze_notified_at", Type: field.TypeTime, Nullable: true},
	}
	// WorkspacesTable holds the schema information for the "workspaces" table.
	WorkspacesTable = &schema.Table{
		Name:       "workspaces",
		Columns:    WorkspacesColumns,
		PrimaryKey: []*schema.Column{WorkspacesColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "workspace_feed_position_id",
				Unique:  false,
				Columns: []*schema.Column{WorkspacesColumns[13], WorkspacesColumns[0]},
			},
		},
	}
	// Tables holds all the tables in the schema.
	Tables = []*schema.Table{
		APITokensTable,
		AuditEntriesTable,
		AuthAttemptsTable,
		AutomationsTable,
		AutomationRunsTable,
		AutomationVersionsTable,
		BrandKitsTable,
		BroadcastsTable,
		BroadcastRecipientsTable,
		CapturedMessagesTable,
		ConfirmationsTable,
		ContactsTable,
		ContactTagsTable,
		CustomFieldsTable,
		EmailTemplatesTable,
		ErasuresTable,
		EventsTable,
		HoldsTable,
		InstanceStateTable,
		IntegrationsTable,
		InvitationsTable,
		JoinDomainsTable,
		MembershipsTable,
		OauthClientsTable,
		OauthCodesTable,
		OauthRefreshTokensTable,
		OutboundMessagesTable,
		PasskeysTable,
		PasskeyChallengesTable,
		PrivateRelayRangesTable,
		RecoveryCodesTable,
		RulesTable,
		RuleFiringsTable,
		RuleTriggersTable,
		SchemaStateTable,
		SegmentsTable,
		SendLimitersTable,
		SendingDomainsTable,
		ServiceCredentialsTable,
		SignupSurveyResponsesTable,
		StaffMembersTable,
		SuppressionsTable,
		TagsTable,
		TrackingHostChangesTable,
		UnsubscribesTable,
		UsagesTable,
		UsersTable,
		UserIdentitiesTable,
		VisitorsTable,
		WebhookEndpointsTable,
		WorkspacesTable,
	}
)

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.

func Diff

func Diff(ctx context.Context, url string, opts ...schema.MigrateOption) error

Diff compares the state read from a database connection or migration directory with the state defined by the Ent schema. Changes will be written to new migration files.

func NamedDiff

func NamedDiff(ctx context.Context, url, name string, opts ...schema.MigrateOption) error

NamedDiff compares the state read from a database connection or migration directory with the state defined by the Ent schema. Changes will be written to new named migration files.

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) Diff

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

Diff creates a migration file containing the statements to resolve the diff between the Ent schema and the connected database.

func (*Schema) NamedDiff

func (s *Schema) NamedDiff(ctx context.Context, name string, opts ...schema.MigrateOption) error

NamedDiff creates a named migration file containing the statements to resolve the diff between the Ent schema and the connected database.

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