Documentation
¶
Index ¶
- Variables
- func Create(ctx context.Context, s *Schema, tables []*schema.Table, ...) error
- func Diff(ctx context.Context, url string, opts ...schema.MigrateOption) error
- func NamedDiff(ctx context.Context, url, name string, opts ...schema.MigrateOption) error
- type Schema
- func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error
- func (s *Schema) Diff(ctx context.Context, opts ...schema.MigrateOption) error
- func (s *Schema) NamedDiff(ctx context.Context, name string, opts ...schema.MigrateOption) error
- func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error
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 ( // AppsColumns holds the columns for the "apps" table. AppsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "name", Type: field.TypeString}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "type", Type: field.TypeString}, {Name: "status", Type: field.TypeString}, {Name: "is_default", Type: field.TypeBool, Default: false}, } // AppsTable holds the schema information for the "apps" table. AppsTable = &schema.Table{ Name: "apps", Columns: AppsColumns, PrimaryKey: []*schema.Column{AppsColumns[0]}, Indexes: []*schema.Index{ { Name: "app_id", Unique: true, Columns: []*schema.Column{AppsColumns[0]}, }, { Name: "app_namespace", Unique: false, Columns: []*schema.Column{AppsColumns[1]}, }, { Name: "app_namespace_id", Unique: true, Columns: []*schema.Column{AppsColumns[1], AppsColumns[0]}, }, { Name: "app_namespace_type", Unique: false, Columns: []*schema.Column{AppsColumns[1], AppsColumns[8]}, }, { Name: "app_namespace_type_is_default", Unique: true, Columns: []*schema.Column{AppsColumns[1], AppsColumns[8], AppsColumns[10]}, Annotation: &entsql.IndexAnnotation{ Where: "is_default = true AND deleted_at IS NULL", }, }, }, } // AppCustomersColumns holds the columns for the "app_customers" table. AppCustomersColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "namespace", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "app_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "customer_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // AppCustomersTable holds the schema information for the "app_customers" table. AppCustomersTable = &schema.Table{ Name: "app_customers", Columns: AppCustomersColumns, PrimaryKey: []*schema.Column{AppCustomersColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "app_customers_apps_customer_apps", Columns: []*schema.Column{AppCustomersColumns[5]}, RefColumns: []*schema.Column{AppsColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "app_customers_customers_apps", Columns: []*schema.Column{AppCustomersColumns[6]}, RefColumns: []*schema.Column{CustomersColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "appcustomer_namespace", Unique: false, Columns: []*schema.Column{AppCustomersColumns[1]}, }, { Name: "appcustomer_namespace_app_id_customer_id", Unique: true, Columns: []*schema.Column{AppCustomersColumns[1], AppCustomersColumns[5], AppCustomersColumns[6]}, }, }, } // AppStripesColumns holds the columns for the "app_stripes" table. AppStripesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "stripe_account_id", Type: field.TypeString}, {Name: "stripe_livemode", Type: field.TypeBool}, {Name: "api_key", Type: field.TypeString}, {Name: "stripe_webhook_id", Type: field.TypeString}, {Name: "webhook_secret", Type: field.TypeString}, } // AppStripesTable holds the schema information for the "app_stripes" table. AppStripesTable = &schema.Table{ Name: "app_stripes", Columns: AppStripesColumns, PrimaryKey: []*schema.Column{AppStripesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "app_stripes_apps_app", Columns: []*schema.Column{AppStripesColumns[0]}, RefColumns: []*schema.Column{AppsColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "appstripe_id", Unique: true, Columns: []*schema.Column{AppStripesColumns[0]}, }, { Name: "appstripe_namespace", Unique: false, Columns: []*schema.Column{AppStripesColumns[1]}, }, { Name: "appstripe_namespace_stripe_account_id_stripe_livemode", Unique: true, Columns: []*schema.Column{AppStripesColumns[1], AppStripesColumns[5], AppStripesColumns[6]}, Annotation: &entsql.IndexAnnotation{ Where: "deleted_at IS NULL", }, }, }, } // AppStripeCustomersColumns holds the columns for the "app_stripe_customers" table. AppStripeCustomersColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "namespace", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "stripe_customer_id", Type: field.TypeString}, {Name: "stripe_default_payment_method_id", Type: field.TypeString, Nullable: true}, {Name: "app_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "customer_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // AppStripeCustomersTable holds the schema information for the "app_stripe_customers" table. AppStripeCustomersTable = &schema.Table{ Name: "app_stripe_customers", Columns: AppStripeCustomersColumns, PrimaryKey: []*schema.Column{AppStripeCustomersColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "app_stripe_customers_app_stripes_customer_apps", Columns: []*schema.Column{AppStripeCustomersColumns[7]}, RefColumns: []*schema.Column{AppStripesColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "app_stripe_customers_customers_customer", Columns: []*schema.Column{AppStripeCustomersColumns[8]}, RefColumns: []*schema.Column{CustomersColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "appstripecustomer_namespace", Unique: false, Columns: []*schema.Column{AppStripeCustomersColumns[1]}, }, { Name: "appstripecustomer_namespace_app_id_customer_id", Unique: true, Columns: []*schema.Column{AppStripeCustomersColumns[1], AppStripeCustomersColumns[7], AppStripeCustomersColumns[8]}, }, { Name: "appstripecustomer_app_id_stripe_customer_id", Unique: true, Columns: []*schema.Column{AppStripeCustomersColumns[7], AppStripeCustomersColumns[5]}, }, }, } // BalanceSnapshotsColumns holds the columns for the "balance_snapshots" table. BalanceSnapshotsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "namespace", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "grant_balances", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "usage", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "balance", Type: field.TypeFloat64, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "overage", Type: field.TypeFloat64, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "at", Type: field.TypeTime}, {Name: "owner_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // BalanceSnapshotsTable holds the schema information for the "balance_snapshots" table. BalanceSnapshotsTable = &schema.Table{ Name: "balance_snapshots", Columns: BalanceSnapshotsColumns, PrimaryKey: []*schema.Column{BalanceSnapshotsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "balance_snapshots_entitlements_balance_snapshot", Columns: []*schema.Column{BalanceSnapshotsColumns[10]}, RefColumns: []*schema.Column{EntitlementsColumns[0]}, OnDelete: schema.NoAction, }, }, Indexes: []*schema.Index{ { Name: "balancesnapshot_namespace", Unique: false, Columns: []*schema.Column{BalanceSnapshotsColumns[1]}, }, { Name: "balancesnapshot_namespace_at", Unique: false, Columns: []*schema.Column{BalanceSnapshotsColumns[1], BalanceSnapshotsColumns[9]}, }, { Name: "balancesnapshot_namespace_balance", Unique: false, Columns: []*schema.Column{BalanceSnapshotsColumns[1], BalanceSnapshotsColumns[7]}, }, { Name: "balancesnapshot_namespace_balance_at", Unique: false, Columns: []*schema.Column{BalanceSnapshotsColumns[1], BalanceSnapshotsColumns[7], BalanceSnapshotsColumns[9]}, }, }, } // BillingCustomerLocksColumns holds the columns for the "billing_customer_locks" table. BillingCustomerLocksColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "customer_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // BillingCustomerLocksTable holds the schema information for the "billing_customer_locks" table. BillingCustomerLocksTable = &schema.Table{ Name: "billing_customer_locks", Columns: BillingCustomerLocksColumns, PrimaryKey: []*schema.Column{BillingCustomerLocksColumns[0]}, Indexes: []*schema.Index{ { Name: "billingcustomerlock_namespace", Unique: false, Columns: []*schema.Column{BillingCustomerLocksColumns[1]}, }, { Name: "billingcustomerlock_id", Unique: true, Columns: []*schema.Column{BillingCustomerLocksColumns[0]}, }, { Name: "billingcustomerlock_namespace_customer_id", Unique: true, Columns: []*schema.Column{BillingCustomerLocksColumns[1], BillingCustomerLocksColumns[2]}, }, }, } // BillingCustomerOverridesColumns holds the columns for the "billing_customer_overrides" table. BillingCustomerOverridesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "collection_alignment", Type: field.TypeEnum, Nullable: true, Enums: []string{"subscription"}}, {Name: "line_collection_period", Type: field.TypeString, Nullable: true}, {Name: "invoice_auto_advance", Type: field.TypeBool, Nullable: true}, {Name: "invoice_draft_period", Type: field.TypeString, Nullable: true}, {Name: "invoice_due_after", Type: field.TypeString, Nullable: true}, {Name: "invoice_collection_method", Type: field.TypeEnum, Nullable: true, Enums: []string{"charge_automatically", "send_invoice"}}, {Name: "invoice_progressive_billing", Type: field.TypeBool, Nullable: true}, {Name: "invoice_default_tax_config", Type: field.TypeJSON, Nullable: true}, {Name: "billing_profile_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "customer_id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, } // BillingCustomerOverridesTable holds the schema information for the "billing_customer_overrides" table. BillingCustomerOverridesTable = &schema.Table{ Name: "billing_customer_overrides", Columns: BillingCustomerOverridesColumns, PrimaryKey: []*schema.Column{BillingCustomerOverridesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "billing_customer_overrides_billing_profiles_billing_customer_override", Columns: []*schema.Column{BillingCustomerOverridesColumns[13]}, RefColumns: []*schema.Column{BillingProfilesColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "billing_customer_overrides_customers_billing_customer_override", Columns: []*schema.Column{BillingCustomerOverridesColumns[14]}, RefColumns: []*schema.Column{CustomersColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "billingcustomeroverride_id", Unique: true, Columns: []*schema.Column{BillingCustomerOverridesColumns[0]}, }, { Name: "billingcustomeroverride_namespace", Unique: false, Columns: []*schema.Column{BillingCustomerOverridesColumns[1]}, }, { Name: "billingcustomeroverride_namespace_id", Unique: true, Columns: []*schema.Column{BillingCustomerOverridesColumns[1], BillingCustomerOverridesColumns[0]}, }, { Name: "billingcustomeroverride_namespace_customer_id", Unique: true, Columns: []*schema.Column{BillingCustomerOverridesColumns[1], BillingCustomerOverridesColumns[14]}, }, }, } // BillingInvoicesColumns holds the columns for the "billing_invoices" table. BillingInvoicesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "supplier_address_country", Type: field.TypeString, Nullable: true, Size: 2}, {Name: "supplier_address_postal_code", Type: field.TypeString, Nullable: true}, {Name: "supplier_address_state", Type: field.TypeString, Nullable: true}, {Name: "supplier_address_city", Type: field.TypeString, Nullable: true}, {Name: "supplier_address_line1", Type: field.TypeString, Nullable: true}, {Name: "supplier_address_line2", Type: field.TypeString, Nullable: true}, {Name: "supplier_address_phone_number", Type: field.TypeString, Nullable: true}, {Name: "customer_address_country", Type: field.TypeString, Nullable: true, Size: 2}, {Name: "customer_address_postal_code", Type: field.TypeString, Nullable: true}, {Name: "customer_address_state", Type: field.TypeString, Nullable: true}, {Name: "customer_address_city", Type: field.TypeString, Nullable: true}, {Name: "customer_address_line1", Type: field.TypeString, Nullable: true}, {Name: "customer_address_line2", Type: field.TypeString, Nullable: true}, {Name: "customer_address_phone_number", Type: field.TypeString, Nullable: true}, {Name: "amount", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "taxes_total", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "taxes_inclusive_total", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "taxes_exclusive_total", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "charges_total", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "discounts_total", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "total", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "supplier_name", Type: field.TypeString}, {Name: "supplier_tax_code", Type: field.TypeString, Nullable: true}, {Name: "customer_name", Type: field.TypeString}, {Name: "customer_usage_attribution", Type: field.TypeJSON}, {Name: "number", Type: field.TypeString}, {Name: "type", Type: field.TypeEnum, Enums: []string{"standard", "credit-note"}}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "voided_at", Type: field.TypeTime, Nullable: true}, {Name: "issued_at", Type: field.TypeTime, Nullable: true}, {Name: "sent_to_customer_at", Type: field.TypeTime, Nullable: true}, {Name: "draft_until", Type: field.TypeTime, Nullable: true}, {Name: "currency", Type: field.TypeString, SchemaType: map[string]string{"postgres": "varchar(3)"}}, {Name: "due_at", Type: field.TypeTime, Nullable: true}, {Name: "status", Type: field.TypeEnum, Enums: []string{"gathering", "draft.created", "draft.updating", "draft.manual_approval_needed", "draft.validating", "draft.invalid", "draft.syncing", "draft.sync_failed", "draft.waiting_auto_approval", "draft.ready_to_issue", "delete.in_progress", "delete.syncing", "delete.failed", "deleted", "issuing.syncing", "issuing.failed", "issued", "payment_processing.pending", "payment_processing.failed", "payment_processing.action_required", "overdue", "paid", "uncollectible", "voided"}}, {Name: "status_details_cache", Type: field.TypeJSON, Nullable: true}, {Name: "invoicing_app_external_id", Type: field.TypeString, Nullable: true}, {Name: "payment_app_external_id", Type: field.TypeString, Nullable: true}, {Name: "tax_app_external_id", Type: field.TypeString, Nullable: true}, {Name: "period_start", Type: field.TypeTime, Nullable: true}, {Name: "period_end", Type: field.TypeTime, Nullable: true}, {Name: "collection_at", Type: field.TypeTime, Nullable: true}, {Name: "tax_app_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "invoicing_app_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "payment_app_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "source_billing_profile_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "workflow_config_id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "customer_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // BillingInvoicesTable holds the schema information for the "billing_invoices" table. BillingInvoicesTable = &schema.Table{ Name: "billing_invoices", Columns: BillingInvoicesColumns, PrimaryKey: []*schema.Column{BillingInvoicesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "billing_invoices_apps_billing_invoice_tax_app", Columns: []*schema.Column{BillingInvoicesColumns[48]}, RefColumns: []*schema.Column{AppsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "billing_invoices_apps_billing_invoice_invoicing_app", Columns: []*schema.Column{BillingInvoicesColumns[49]}, RefColumns: []*schema.Column{AppsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "billing_invoices_apps_billing_invoice_payment_app", Columns: []*schema.Column{BillingInvoicesColumns[50]}, RefColumns: []*schema.Column{AppsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "billing_invoices_billing_profiles_billing_invoices", Columns: []*schema.Column{BillingInvoicesColumns[51]}, RefColumns: []*schema.Column{BillingProfilesColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "billing_invoices_billing_workflow_configs_billing_invoices", Columns: []*schema.Column{BillingInvoicesColumns[52]}, RefColumns: []*schema.Column{BillingWorkflowConfigsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "billing_invoices_customers_billing_invoice", Columns: []*schema.Column{BillingInvoicesColumns[53]}, RefColumns: []*schema.Column{CustomersColumns[0]}, OnDelete: schema.NoAction, }, }, Indexes: []*schema.Index{ { Name: "billinginvoice_id", Unique: true, Columns: []*schema.Column{BillingInvoicesColumns[0]}, }, { Name: "billinginvoice_namespace", Unique: false, Columns: []*schema.Column{BillingInvoicesColumns[1]}, }, { Name: "billinginvoice_namespace_id", Unique: false, Columns: []*schema.Column{BillingInvoicesColumns[1], BillingInvoicesColumns[0]}, }, { Name: "billinginvoice_namespace_customer_id", Unique: false, Columns: []*schema.Column{BillingInvoicesColumns[1], BillingInvoicesColumns[53]}, }, { Name: "billinginvoice_namespace_status", Unique: false, Columns: []*schema.Column{BillingInvoicesColumns[1], BillingInvoicesColumns[40]}, }, { Name: "billinginvoice_status_details_cache", Unique: false, Columns: []*schema.Column{BillingInvoicesColumns[41]}, Annotation: &entsql.IndexAnnotation{ Types: map[string]string{ "postgres": "GIN", }, }, }, }, } // BillingInvoiceDiscountsColumns holds the columns for the "billing_invoice_discounts" table. BillingInvoiceDiscountsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "name", Type: field.TypeString}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "type", Type: field.TypeEnum, Enums: []string{"percentage"}}, {Name: "amount", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "line_ids", Type: field.TypeJSON, Nullable: true}, {Name: "invoice_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // BillingInvoiceDiscountsTable holds the schema information for the "billing_invoice_discounts" table. BillingInvoiceDiscountsTable = &schema.Table{ Name: "billing_invoice_discounts", Columns: BillingInvoiceDiscountsColumns, PrimaryKey: []*schema.Column{BillingInvoiceDiscountsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "billing_invoice_discounts_billing_invoices_invoice_discounts", Columns: []*schema.Column{BillingInvoiceDiscountsColumns[11]}, RefColumns: []*schema.Column{BillingInvoicesColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "billinginvoicediscount_id", Unique: true, Columns: []*schema.Column{BillingInvoiceDiscountsColumns[0]}, }, { Name: "billinginvoicediscount_namespace", Unique: false, Columns: []*schema.Column{BillingInvoiceDiscountsColumns[1]}, }, { Name: "billinginvoicediscount_namespace_id", Unique: true, Columns: []*schema.Column{BillingInvoiceDiscountsColumns[1], BillingInvoiceDiscountsColumns[0]}, }, { Name: "billinginvoicediscount_namespace_invoice_id", Unique: false, Columns: []*schema.Column{BillingInvoiceDiscountsColumns[1], BillingInvoiceDiscountsColumns[11]}, }, }, } // BillingInvoiceFlatFeeLineConfigsColumns holds the columns for the "billing_invoice_flat_fee_line_configs" table. BillingInvoiceFlatFeeLineConfigsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "per_unit_amount", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "category", Type: field.TypeEnum, Enums: []string{"regular", "commitment"}, Default: "regular"}, {Name: "payment_term", Type: field.TypeEnum, Enums: []string{"in_advance", "in_arrears"}, Default: "in_advance"}, } // BillingInvoiceFlatFeeLineConfigsTable holds the schema information for the "billing_invoice_flat_fee_line_configs" table. BillingInvoiceFlatFeeLineConfigsTable = &schema.Table{ Name: "billing_invoice_flat_fee_line_configs", Columns: BillingInvoiceFlatFeeLineConfigsColumns, PrimaryKey: []*schema.Column{BillingInvoiceFlatFeeLineConfigsColumns[0]}, Indexes: []*schema.Index{ { Name: "billinginvoiceflatfeelineconfig_namespace", Unique: false, Columns: []*schema.Column{BillingInvoiceFlatFeeLineConfigsColumns[1]}, }, { Name: "billinginvoiceflatfeelineconfig_id", Unique: true, Columns: []*schema.Column{BillingInvoiceFlatFeeLineConfigsColumns[0]}, }, }, } // BillingInvoiceLinesColumns holds the columns for the "billing_invoice_lines" table. BillingInvoiceLinesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "name", Type: field.TypeString}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "amount", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "taxes_total", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "taxes_inclusive_total", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "taxes_exclusive_total", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "charges_total", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "discounts_total", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "total", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "managed_by", Type: field.TypeEnum, Enums: []string{"subscription", "system", "manual"}}, {Name: "period_start", Type: field.TypeTime}, {Name: "period_end", Type: field.TypeTime}, {Name: "invoice_at", Type: field.TypeTime}, {Name: "type", Type: field.TypeEnum, Enums: []string{"flat_fee", "usage_based"}}, {Name: "status", Type: field.TypeEnum, Enums: []string{"valid", "split", "detailed"}}, {Name: "currency", Type: field.TypeString, SchemaType: map[string]string{"postgres": "varchar(3)"}}, {Name: "quantity", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "tax_config", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "invoicing_app_external_id", Type: field.TypeString, Nullable: true}, {Name: "child_unique_reference_id", Type: field.TypeString, Nullable: true}, {Name: "invoice_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "line_ids", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "fee_line_config_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "usage_based_line_config_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "parent_line_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "subscription_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "subscription_item_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "subscription_phase_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "char(26)"}}, } // BillingInvoiceLinesTable holds the schema information for the "billing_invoice_lines" table. BillingInvoiceLinesTable = &schema.Table{ Name: "billing_invoice_lines", Columns: BillingInvoiceLinesColumns, PrimaryKey: []*schema.Column{BillingInvoiceLinesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "billing_invoice_lines_billing_invoices_billing_invoice_lines", Columns: []*schema.Column{BillingInvoiceLinesColumns[26]}, RefColumns: []*schema.Column{BillingInvoicesColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "billing_invoice_lines_billing_invoice_discounts_lines", Columns: []*schema.Column{BillingInvoiceLinesColumns[27]}, RefColumns: []*schema.Column{BillingInvoiceDiscountsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "billing_invoice_lines_billing_invoice_flat_fee_line_configs_flat_fee_line", Columns: []*schema.Column{BillingInvoiceLinesColumns[28]}, RefColumns: []*schema.Column{BillingInvoiceFlatFeeLineConfigsColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "billing_invoice_lines_billing_invoice_usage_based_line_configs_usage_based_line", Columns: []*schema.Column{BillingInvoiceLinesColumns[29]}, RefColumns: []*schema.Column{BillingInvoiceUsageBasedLineConfigsColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "billing_invoice_lines_billing_invoice_lines_detailed_lines", Columns: []*schema.Column{BillingInvoiceLinesColumns[30]}, RefColumns: []*schema.Column{BillingInvoiceLinesColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "billing_invoice_lines_subscriptions_billing_lines", Columns: []*schema.Column{BillingInvoiceLinesColumns[31]}, RefColumns: []*schema.Column{SubscriptionsColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "billing_invoice_lines_subscription_items_billing_lines", Columns: []*schema.Column{BillingInvoiceLinesColumns[32]}, RefColumns: []*schema.Column{SubscriptionItemsColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "billing_invoice_lines_subscription_phases_billing_lines", Columns: []*schema.Column{BillingInvoiceLinesColumns[33]}, RefColumns: []*schema.Column{SubscriptionPhasesColumns[0]}, OnDelete: schema.SetNull, }, }, Indexes: []*schema.Index{ { Name: "billinginvoiceline_id", Unique: true, Columns: []*schema.Column{BillingInvoiceLinesColumns[0]}, }, { Name: "billinginvoiceline_namespace", Unique: false, Columns: []*schema.Column{BillingInvoiceLinesColumns[1]}, }, { Name: "billinginvoiceline_namespace_id", Unique: true, Columns: []*schema.Column{BillingInvoiceLinesColumns[1], BillingInvoiceLinesColumns[0]}, }, { Name: "billinginvoiceline_namespace_invoice_id", Unique: false, Columns: []*schema.Column{BillingInvoiceLinesColumns[1], BillingInvoiceLinesColumns[26]}, }, { Name: "billinginvoiceline_namespace_parent_line_id", Unique: false, Columns: []*schema.Column{BillingInvoiceLinesColumns[1], BillingInvoiceLinesColumns[30]}, }, { Name: "billinginvoiceline_namespace_parent_line_id_child_unique_reference_id", Unique: true, Columns: []*schema.Column{BillingInvoiceLinesColumns[1], BillingInvoiceLinesColumns[30], BillingInvoiceLinesColumns[25]}, Annotation: &entsql.IndexAnnotation{ Where: "child_unique_reference_id IS NOT NULL AND deleted_at IS NULL", }, }, { Name: "billinginvoiceline_namespace_subscription_id_subscription_phase_id_subscription_item_id", Unique: false, Columns: []*schema.Column{BillingInvoiceLinesColumns[1], BillingInvoiceLinesColumns[31], BillingInvoiceLinesColumns[33], BillingInvoiceLinesColumns[32]}, }, }, } // BillingInvoiceLineDiscountsColumns holds the columns for the "billing_invoice_line_discounts" table. BillingInvoiceLineDiscountsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "child_unique_reference_id", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "amount", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "invoicing_app_external_id", Type: field.TypeString, Nullable: true}, {Name: "line_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // BillingInvoiceLineDiscountsTable holds the schema information for the "billing_invoice_line_discounts" table. BillingInvoiceLineDiscountsTable = &schema.Table{ Name: "billing_invoice_line_discounts", Columns: BillingInvoiceLineDiscountsColumns, PrimaryKey: []*schema.Column{BillingInvoiceLineDiscountsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "billing_invoice_line_discounts_billing_invoice_lines_line_discounts", Columns: []*schema.Column{BillingInvoiceLineDiscountsColumns[9]}, RefColumns: []*schema.Column{BillingInvoiceLinesColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "billinginvoicelinediscount_id", Unique: true, Columns: []*schema.Column{BillingInvoiceLineDiscountsColumns[0]}, }, { Name: "billinginvoicelinediscount_namespace", Unique: false, Columns: []*schema.Column{BillingInvoiceLineDiscountsColumns[1]}, }, { Name: "billinginvoicelinediscount_namespace_line_id", Unique: false, Columns: []*schema.Column{BillingInvoiceLineDiscountsColumns[1], BillingInvoiceLineDiscountsColumns[9]}, }, { Name: "billinginvoicelinediscount_namespace_line_id_child_unique_reference_id", Unique: true, Columns: []*schema.Column{BillingInvoiceLineDiscountsColumns[1], BillingInvoiceLineDiscountsColumns[9], BillingInvoiceLineDiscountsColumns[5]}, Annotation: &entsql.IndexAnnotation{ Where: "child_unique_reference_id IS NOT NULL AND deleted_at IS NULL", }, }, }, } // BillingInvoiceUsageBasedLineConfigsColumns holds the columns for the "billing_invoice_usage_based_line_configs" table. BillingInvoiceUsageBasedLineConfigsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "price_type", Type: field.TypeEnum, Enums: []string{"flat", "unit", "tiered"}}, {Name: "feature_key", Type: field.TypeString}, {Name: "price", Type: field.TypeString, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "pre_line_period_quantity", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "numeric"}}, } // BillingInvoiceUsageBasedLineConfigsTable holds the schema information for the "billing_invoice_usage_based_line_configs" table. BillingInvoiceUsageBasedLineConfigsTable = &schema.Table{ Name: "billing_invoice_usage_based_line_configs", Columns: BillingInvoiceUsageBasedLineConfigsColumns, PrimaryKey: []*schema.Column{BillingInvoiceUsageBasedLineConfigsColumns[0]}, Indexes: []*schema.Index{ { Name: "billinginvoiceusagebasedlineconfig_namespace", Unique: false, Columns: []*schema.Column{BillingInvoiceUsageBasedLineConfigsColumns[1]}, }, { Name: "billinginvoiceusagebasedlineconfig_id", Unique: true, Columns: []*schema.Column{BillingInvoiceUsageBasedLineConfigsColumns[0]}, }, }, } // BillingInvoiceValidationIssuesColumns holds the columns for the "billing_invoice_validation_issues" table. BillingInvoiceValidationIssuesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "severity", Type: field.TypeEnum, Enums: []string{"critical", "warning"}}, {Name: "code", Type: field.TypeString, Nullable: true}, {Name: "message", Type: field.TypeString}, {Name: "path", Type: field.TypeString, Nullable: true}, {Name: "component", Type: field.TypeString}, {Name: "dedupe_hash", Type: field.TypeBytes, Size: 32}, {Name: "invoice_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // BillingInvoiceValidationIssuesTable holds the schema information for the "billing_invoice_validation_issues" table. BillingInvoiceValidationIssuesTable = &schema.Table{ Name: "billing_invoice_validation_issues", Columns: BillingInvoiceValidationIssuesColumns, PrimaryKey: []*schema.Column{BillingInvoiceValidationIssuesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "billing_invoice_validation_issues_billing_invoices_billing_invoice_validation_issues", Columns: []*schema.Column{BillingInvoiceValidationIssuesColumns[11]}, RefColumns: []*schema.Column{BillingInvoicesColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "billinginvoicevalidationissue_id", Unique: true, Columns: []*schema.Column{BillingInvoiceValidationIssuesColumns[0]}, }, { Name: "billinginvoicevalidationissue_namespace", Unique: false, Columns: []*schema.Column{BillingInvoiceValidationIssuesColumns[1]}, }, { Name: "billinginvoicevalidationissue_namespace_invoice_id_dedupe_hash", Unique: true, Columns: []*schema.Column{BillingInvoiceValidationIssuesColumns[1], BillingInvoiceValidationIssuesColumns[11], BillingInvoiceValidationIssuesColumns[10]}, }, }, } // BillingProfilesColumns holds the columns for the "billing_profiles" table. BillingProfilesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "name", Type: field.TypeString}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "supplier_address_country", Type: field.TypeString, Nullable: true, Size: 2}, {Name: "supplier_address_postal_code", Type: field.TypeString, Nullable: true}, {Name: "supplier_address_state", Type: field.TypeString, Nullable: true}, {Name: "supplier_address_city", Type: field.TypeString, Nullable: true}, {Name: "supplier_address_line1", Type: field.TypeString, Nullable: true}, {Name: "supplier_address_line2", Type: field.TypeString, Nullable: true}, {Name: "supplier_address_phone_number", Type: field.TypeString, Nullable: true}, {Name: "default", Type: field.TypeBool, Default: false}, {Name: "supplier_name", Type: field.TypeString}, {Name: "supplier_tax_code", Type: field.TypeString, Nullable: true}, {Name: "tax_app_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "invoicing_app_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "payment_app_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "workflow_config_id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, } // BillingProfilesTable holds the schema information for the "billing_profiles" table. BillingProfilesTable = &schema.Table{ Name: "billing_profiles", Columns: BillingProfilesColumns, PrimaryKey: []*schema.Column{BillingProfilesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "billing_profiles_apps_billing_profile_tax_app", Columns: []*schema.Column{BillingProfilesColumns[18]}, RefColumns: []*schema.Column{AppsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "billing_profiles_apps_billing_profile_invoicing_app", Columns: []*schema.Column{BillingProfilesColumns[19]}, RefColumns: []*schema.Column{AppsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "billing_profiles_apps_billing_profile_payment_app", Columns: []*schema.Column{BillingProfilesColumns[20]}, RefColumns: []*schema.Column{AppsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "billing_profiles_billing_workflow_configs_billing_profile", Columns: []*schema.Column{BillingProfilesColumns[21]}, RefColumns: []*schema.Column{BillingWorkflowConfigsColumns[0]}, OnDelete: schema.NoAction, }, }, Indexes: []*schema.Index{ { Name: "billingprofile_id", Unique: true, Columns: []*schema.Column{BillingProfilesColumns[0]}, }, { Name: "billingprofile_namespace", Unique: false, Columns: []*schema.Column{BillingProfilesColumns[1]}, }, { Name: "billingprofile_namespace_id", Unique: true, Columns: []*schema.Column{BillingProfilesColumns[1], BillingProfilesColumns[0]}, }, { Name: "billingprofile_namespace_default", Unique: true, Columns: []*schema.Column{BillingProfilesColumns[1], BillingProfilesColumns[15]}, Annotation: &entsql.IndexAnnotation{ Where: "\"default\" AND deleted_at IS NULL", }, }, }, } // BillingSequenceNumbersColumns holds the columns for the "billing_sequence_numbers" table. BillingSequenceNumbersColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "namespace", Type: field.TypeString}, {Name: "scope", Type: field.TypeString}, {Name: "last", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, } // BillingSequenceNumbersTable holds the schema information for the "billing_sequence_numbers" table. BillingSequenceNumbersTable = &schema.Table{ Name: "billing_sequence_numbers", Columns: BillingSequenceNumbersColumns, PrimaryKey: []*schema.Column{BillingSequenceNumbersColumns[0]}, Indexes: []*schema.Index{ { Name: "billingsequencenumbers_namespace", Unique: false, Columns: []*schema.Column{BillingSequenceNumbersColumns[1]}, }, { Name: "billingsequencenumbers_namespace_scope", Unique: true, Columns: []*schema.Column{BillingSequenceNumbersColumns[1], BillingSequenceNumbersColumns[2]}, }, }, } // BillingWorkflowConfigsColumns holds the columns for the "billing_workflow_configs" table. BillingWorkflowConfigsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "collection_alignment", Type: field.TypeEnum, Enums: []string{"subscription"}}, {Name: "line_collection_period", Type: field.TypeString}, {Name: "invoice_auto_advance", Type: field.TypeBool}, {Name: "invoice_draft_period", Type: field.TypeString}, {Name: "invoice_due_after", Type: field.TypeString}, {Name: "invoice_collection_method", Type: field.TypeEnum, Enums: []string{"charge_automatically", "send_invoice"}}, {Name: "invoice_progressive_billing", Type: field.TypeBool}, {Name: "invoice_default_tax_settings", Type: field.TypeJSON, Nullable: true}, } // BillingWorkflowConfigsTable holds the schema information for the "billing_workflow_configs" table. BillingWorkflowConfigsTable = &schema.Table{ Name: "billing_workflow_configs", Columns: BillingWorkflowConfigsColumns, PrimaryKey: []*schema.Column{BillingWorkflowConfigsColumns[0]}, Indexes: []*schema.Index{ { Name: "billingworkflowconfig_id", Unique: true, Columns: []*schema.Column{BillingWorkflowConfigsColumns[0]}, }, { Name: "billingworkflowconfig_namespace", Unique: false, Columns: []*schema.Column{BillingWorkflowConfigsColumns[1]}, }, { Name: "billingworkflowconfig_namespace_id", Unique: false, Columns: []*schema.Column{BillingWorkflowConfigsColumns[1], BillingWorkflowConfigsColumns[0]}, }, }, } // CustomersColumns holds the columns for the "customers" table. CustomersColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "name", Type: field.TypeString}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "billing_address_country", Type: field.TypeString, Nullable: true, Size: 2}, {Name: "billing_address_postal_code", Type: field.TypeString, Nullable: true}, {Name: "billing_address_state", Type: field.TypeString, Nullable: true}, {Name: "billing_address_city", Type: field.TypeString, Nullable: true}, {Name: "billing_address_line1", Type: field.TypeString, Nullable: true}, {Name: "billing_address_line2", Type: field.TypeString, Nullable: true}, {Name: "billing_address_phone_number", Type: field.TypeString, Nullable: true}, {Name: "key", Type: field.TypeString, Nullable: true}, {Name: "primary_email", Type: field.TypeString, Nullable: true}, {Name: "currency", Type: field.TypeString, Nullable: true, Size: 3}, } // CustomersTable holds the schema information for the "customers" table. CustomersTable = &schema.Table{ Name: "customers", Columns: CustomersColumns, PrimaryKey: []*schema.Column{CustomersColumns[0]}, Indexes: []*schema.Index{ { Name: "customer_id", Unique: true, Columns: []*schema.Column{CustomersColumns[0]}, }, { Name: "customer_namespace", Unique: false, Columns: []*schema.Column{CustomersColumns[1]}, }, { Name: "customer_namespace_id", Unique: true, Columns: []*schema.Column{CustomersColumns[1], CustomersColumns[0]}, }, { Name: "customer_namespace_key", Unique: true, Columns: []*schema.Column{CustomersColumns[1], CustomersColumns[15]}, Annotation: &entsql.IndexAnnotation{ Where: "deleted_at IS NULL", }, }, { Name: "customer_name", Unique: false, Columns: []*schema.Column{CustomersColumns[6]}, }, { Name: "customer_primary_email", Unique: false, Columns: []*schema.Column{CustomersColumns[16]}, }, { Name: "customer_created_at", Unique: false, Columns: []*schema.Column{CustomersColumns[3]}, }, }, } // CustomerSubjectsColumns holds the columns for the "customer_subjects" table. CustomerSubjectsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "namespace", Type: field.TypeString}, {Name: "subject_key", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "customer_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // CustomerSubjectsTable holds the schema information for the "customer_subjects" table. CustomerSubjectsTable = &schema.Table{ Name: "customer_subjects", Columns: CustomerSubjectsColumns, PrimaryKey: []*schema.Column{CustomerSubjectsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "customer_subjects_customers_subjects", Columns: []*schema.Column{CustomerSubjectsColumns[5]}, RefColumns: []*schema.Column{CustomersColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "customersubjects_namespace", Unique: false, Columns: []*schema.Column{CustomerSubjectsColumns[1]}, }, { Name: "customersubjects_namespace_customer_id_deleted_at", Unique: false, Columns: []*schema.Column{CustomerSubjectsColumns[1], CustomerSubjectsColumns[5], CustomerSubjectsColumns[4]}, }, { Name: "customersubjects_namespace_subject_key", Unique: true, Columns: []*schema.Column{CustomerSubjectsColumns[1], CustomerSubjectsColumns[2]}, Annotation: &entsql.IndexAnnotation{ Where: "deleted_at IS NULL", }, }, }, } // EntitlementsColumns holds the columns for the "entitlements" table. EntitlementsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "entitlement_type", Type: field.TypeEnum, Enums: []string{"metered", "static", "boolean"}}, {Name: "active_from", Type: field.TypeTime, Nullable: true}, {Name: "active_to", Type: field.TypeTime, Nullable: true}, {Name: "feature_key", Type: field.TypeString}, {Name: "subject_key", Type: field.TypeString}, {Name: "measure_usage_from", Type: field.TypeTime, Nullable: true}, {Name: "issue_after_reset", Type: field.TypeFloat64, Nullable: true}, {Name: "issue_after_reset_priority", Type: field.TypeUint8, Nullable: true}, {Name: "is_soft_limit", Type: field.TypeBool, Nullable: true}, {Name: "preserve_overage_at_reset", Type: field.TypeBool, Nullable: true}, {Name: "config", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "usage_period_interval", Type: field.TypeString, Nullable: true}, {Name: "usage_period_anchor", Type: field.TypeTime, Nullable: true}, {Name: "current_usage_period_start", Type: field.TypeTime, Nullable: true}, {Name: "current_usage_period_end", Type: field.TypeTime, Nullable: true}, {Name: "subscription_managed", Type: field.TypeBool, Nullable: true}, {Name: "feature_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // EntitlementsTable holds the schema information for the "entitlements" table. EntitlementsTable = &schema.Table{ Name: "entitlements", Columns: EntitlementsColumns, PrimaryKey: []*schema.Column{EntitlementsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "entitlements_features_entitlement", Columns: []*schema.Column{EntitlementsColumns[22]}, RefColumns: []*schema.Column{FeaturesColumns[0]}, OnDelete: schema.NoAction, }, }, Indexes: []*schema.Index{ { Name: "entitlement_id", Unique: true, Columns: []*schema.Column{EntitlementsColumns[0]}, }, { Name: "entitlement_namespace", Unique: false, Columns: []*schema.Column{EntitlementsColumns[1]}, }, { Name: "entitlement_namespace_id", Unique: false, Columns: []*schema.Column{EntitlementsColumns[1], EntitlementsColumns[0]}, }, { Name: "entitlement_namespace_subject_key", Unique: false, Columns: []*schema.Column{EntitlementsColumns[1], EntitlementsColumns[10]}, }, { Name: "entitlement_namespace_id_subject_key", Unique: false, Columns: []*schema.Column{EntitlementsColumns[1], EntitlementsColumns[0], EntitlementsColumns[10]}, }, { Name: "entitlement_namespace_feature_id_id", Unique: false, Columns: []*schema.Column{EntitlementsColumns[1], EntitlementsColumns[22], EntitlementsColumns[0]}, }, { Name: "entitlement_namespace_current_usage_period_end", Unique: false, Columns: []*schema.Column{EntitlementsColumns[1], EntitlementsColumns[20]}, }, { Name: "entitlement_current_usage_period_end_deleted_at", Unique: false, Columns: []*schema.Column{EntitlementsColumns[20], EntitlementsColumns[5]}, }, }, } // FeaturesColumns holds the columns for the "features" table. FeaturesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "namespace", Type: field.TypeString}, {Name: "name", Type: field.TypeString}, {Name: "key", Type: field.TypeString}, {Name: "meter_slug", Type: field.TypeString, Nullable: true}, {Name: "meter_group_by_filters", Type: field.TypeJSON, Nullable: true}, {Name: "archived_at", Type: field.TypeTime, Nullable: true}, } // FeaturesTable holds the schema information for the "features" table. FeaturesTable = &schema.Table{ Name: "features", Columns: FeaturesColumns, PrimaryKey: []*schema.Column{FeaturesColumns[0]}, Indexes: []*schema.Index{ { Name: "feature_id", Unique: true, Columns: []*schema.Column{FeaturesColumns[0]}, }, { Name: "feature_namespace_id", Unique: false, Columns: []*schema.Column{FeaturesColumns[5], FeaturesColumns[0]}, }, { Name: "feature_namespace_key", Unique: true, Columns: []*schema.Column{FeaturesColumns[5], FeaturesColumns[7]}, Annotation: &entsql.IndexAnnotation{ Where: "archived_at IS NULL", }, }, }, } // GrantsColumns holds the columns for the "grants" table. GrantsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "amount", Type: field.TypeFloat64, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "priority", Type: field.TypeUint8, Default: 0}, {Name: "effective_at", Type: field.TypeTime}, {Name: "expiration", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "expires_at", Type: field.TypeTime}, {Name: "voided_at", Type: field.TypeTime, Nullable: true}, {Name: "reset_max_rollover", Type: field.TypeFloat64, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "reset_min_rollover", Type: field.TypeFloat64, SchemaType: map[string]string{"postgres": "numeric"}}, {Name: "recurrence_period", Type: field.TypeString, Nullable: true}, {Name: "recurrence_anchor", Type: field.TypeTime, Nullable: true}, {Name: "owner_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // GrantsTable holds the schema information for the "grants" table. GrantsTable = &schema.Table{ Name: "grants", Columns: GrantsColumns, PrimaryKey: []*schema.Column{GrantsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "grants_entitlements_grant", Columns: []*schema.Column{GrantsColumns[16]}, RefColumns: []*schema.Column{EntitlementsColumns[0]}, OnDelete: schema.NoAction, }, }, Indexes: []*schema.Index{ { Name: "grant_id", Unique: true, Columns: []*schema.Column{GrantsColumns[0]}, }, { Name: "grant_namespace", Unique: false, Columns: []*schema.Column{GrantsColumns[1]}, }, { Name: "grant_namespace_owner_id", Unique: false, Columns: []*schema.Column{GrantsColumns[1], GrantsColumns[16]}, }, { Name: "grant_effective_at_expires_at", Unique: false, Columns: []*schema.Column{GrantsColumns[8], GrantsColumns[10]}, }, }, } // MetersColumns holds the columns for the "meters" table. MetersColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "name", Type: field.TypeString}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "key", Type: field.TypeString}, {Name: "event_type", Type: field.TypeString}, {Name: "value_property", Type: field.TypeString, Nullable: true}, {Name: "group_by", Type: field.TypeJSON, Nullable: true}, {Name: "aggregation", Type: field.TypeEnum, Enums: []string{"SUM", "COUNT", "AVG", "MIN", "MAX", "UNIQUE_COUNT"}}, {Name: "event_from", Type: field.TypeTime, Nullable: true}, } // MetersTable holds the schema information for the "meters" table. MetersTable = &schema.Table{ Name: "meters", Columns: MetersColumns, PrimaryKey: []*schema.Column{MetersColumns[0]}, Indexes: []*schema.Index{ { Name: "meter_id", Unique: true, Columns: []*schema.Column{MetersColumns[0]}, }, { Name: "meter_namespace", Unique: false, Columns: []*schema.Column{MetersColumns[1]}, }, { Name: "meter_namespace_id", Unique: true, Columns: []*schema.Column{MetersColumns[1], MetersColumns[0]}, }, { Name: "meter_namespace_key_deleted_at", Unique: true, Columns: []*schema.Column{MetersColumns[1], MetersColumns[8], MetersColumns[5]}, }, }, } // NotificationChannelsColumns holds the columns for the "notification_channels" table. NotificationChannelsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "type", Type: field.TypeEnum, Enums: []string{"WEBHOOK"}}, {Name: "name", Type: field.TypeString}, {Name: "disabled", Type: field.TypeBool, Nullable: true, Default: false}, {Name: "config", Type: field.TypeString, SchemaType: map[string]string{"postgres": "jsonb"}}, } // NotificationChannelsTable holds the schema information for the "notification_channels" table. NotificationChannelsTable = &schema.Table{ Name: "notification_channels", Columns: NotificationChannelsColumns, PrimaryKey: []*schema.Column{NotificationChannelsColumns[0]}, Indexes: []*schema.Index{ { Name: "notificationchannel_id", Unique: true, Columns: []*schema.Column{NotificationChannelsColumns[0]}, }, { Name: "notificationchannel_namespace", Unique: false, Columns: []*schema.Column{NotificationChannelsColumns[1]}, }, { Name: "notificationchannel_namespace_id", Unique: false, Columns: []*schema.Column{NotificationChannelsColumns[1], NotificationChannelsColumns[0]}, }, { Name: "notificationchannel_namespace_type", Unique: false, Columns: []*schema.Column{NotificationChannelsColumns[1], NotificationChannelsColumns[5]}, }, }, } // NotificationEventsColumns holds the columns for the "notification_events" table. NotificationEventsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "type", Type: field.TypeEnum, Enums: []string{"entitlements.balance.threshold"}}, {Name: "payload", Type: field.TypeString, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "annotations", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "rule_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // NotificationEventsTable holds the schema information for the "notification_events" table. NotificationEventsTable = &schema.Table{ Name: "notification_events", Columns: NotificationEventsColumns, PrimaryKey: []*schema.Column{NotificationEventsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "notification_events_notification_rules_events", Columns: []*schema.Column{NotificationEventsColumns[6]}, RefColumns: []*schema.Column{NotificationRulesColumns[0]}, OnDelete: schema.NoAction, }, }, Indexes: []*schema.Index{ { Name: "notificationevent_id", Unique: true, Columns: []*schema.Column{NotificationEventsColumns[0]}, }, { Name: "notificationevent_namespace", Unique: false, Columns: []*schema.Column{NotificationEventsColumns[1]}, }, { Name: "notificationevent_namespace_id", Unique: false, Columns: []*schema.Column{NotificationEventsColumns[1], NotificationEventsColumns[0]}, }, { Name: "notificationevent_namespace_type", Unique: false, Columns: []*schema.Column{NotificationEventsColumns[1], NotificationEventsColumns[3]}, }, { Name: "notificationevent_annotations", Unique: false, Columns: []*schema.Column{NotificationEventsColumns[5]}, Annotation: &entsql.IndexAnnotation{ Types: map[string]string{ "postgres": "GIN", }, }, }, }, } // NotificationEventDeliveryStatusColumns holds the columns for the "notification_event_delivery_status" table. NotificationEventDeliveryStatusColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "event_id", Type: field.TypeString}, {Name: "channel_id", Type: field.TypeString}, {Name: "state", Type: field.TypeEnum, Enums: []string{"SUCCESS", "FAILED", "SENDING", "PENDING"}, Default: "PENDING"}, {Name: "reason", Type: field.TypeString, Nullable: true}, } // NotificationEventDeliveryStatusTable holds the schema information for the "notification_event_delivery_status" table. NotificationEventDeliveryStatusTable = &schema.Table{ Name: "notification_event_delivery_status", Columns: NotificationEventDeliveryStatusColumns, PrimaryKey: []*schema.Column{NotificationEventDeliveryStatusColumns[0]}, Indexes: []*schema.Index{ { Name: "notificationeventdeliverystatus_id", Unique: true, Columns: []*schema.Column{NotificationEventDeliveryStatusColumns[0]}, }, { Name: "notificationeventdeliverystatus_namespace", Unique: false, Columns: []*schema.Column{NotificationEventDeliveryStatusColumns[1]}, }, { Name: "notificationeventdeliverystatus_namespace_id", Unique: false, Columns: []*schema.Column{NotificationEventDeliveryStatusColumns[1], NotificationEventDeliveryStatusColumns[0]}, }, { Name: "notificationeventdeliverystatus_namespace_event_id_channel_id", Unique: false, Columns: []*schema.Column{NotificationEventDeliveryStatusColumns[1], NotificationEventDeliveryStatusColumns[4], NotificationEventDeliveryStatusColumns[5]}, }, { Name: "notificationeventdeliverystatus_namespace_state", Unique: false, Columns: []*schema.Column{NotificationEventDeliveryStatusColumns[1], NotificationEventDeliveryStatusColumns[6]}, }, }, } // NotificationRulesColumns holds the columns for the "notification_rules" table. NotificationRulesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "type", Type: field.TypeEnum, Enums: []string{"entitlements.balance.threshold"}}, {Name: "name", Type: field.TypeString}, {Name: "disabled", Type: field.TypeBool, Nullable: true, Default: false}, {Name: "config", Type: field.TypeString, SchemaType: map[string]string{"postgres": "jsonb"}}, } // NotificationRulesTable holds the schema information for the "notification_rules" table. NotificationRulesTable = &schema.Table{ Name: "notification_rules", Columns: NotificationRulesColumns, PrimaryKey: []*schema.Column{NotificationRulesColumns[0]}, Indexes: []*schema.Index{ { Name: "notificationrule_id", Unique: true, Columns: []*schema.Column{NotificationRulesColumns[0]}, }, { Name: "notificationrule_namespace", Unique: false, Columns: []*schema.Column{NotificationRulesColumns[1]}, }, { Name: "notificationrule_namespace_id", Unique: false, Columns: []*schema.Column{NotificationRulesColumns[1], NotificationRulesColumns[0]}, }, { Name: "notificationrule_namespace_type", Unique: false, Columns: []*schema.Column{NotificationRulesColumns[1], NotificationRulesColumns[5]}, }, }, } // PlansColumns holds the columns for the "plans" table. PlansColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "name", Type: field.TypeString}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "key", Type: field.TypeString}, {Name: "billables_must_align", Type: field.TypeBool, Default: false}, {Name: "version", Type: field.TypeInt}, {Name: "currency", Type: field.TypeString, Default: "USD"}, {Name: "effective_from", Type: field.TypeTime, Nullable: true}, {Name: "effective_to", Type: field.TypeTime, Nullable: true}, } // PlansTable holds the schema information for the "plans" table. PlansTable = &schema.Table{ Name: "plans", Columns: PlansColumns, PrimaryKey: []*schema.Column{PlansColumns[0]}, Indexes: []*schema.Index{ { Name: "plan_id", Unique: true, Columns: []*schema.Column{PlansColumns[0]}, }, { Name: "plan_namespace", Unique: false, Columns: []*schema.Column{PlansColumns[1]}, }, { Name: "plan_namespace_id", Unique: true, Columns: []*schema.Column{PlansColumns[1], PlansColumns[0]}, }, { Name: "plan_namespace_key_deleted_at", Unique: true, Columns: []*schema.Column{PlansColumns[1], PlansColumns[8], PlansColumns[5]}, }, { Name: "plan_namespace_key_version", Unique: true, Columns: []*schema.Column{PlansColumns[1], PlansColumns[8], PlansColumns[10]}, Annotation: &entsql.IndexAnnotation{ Where: "deleted_at IS NULL", }, }, }, } // PlanPhasesColumns holds the columns for the "plan_phases" table. PlanPhasesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "name", Type: field.TypeString}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "key", Type: field.TypeString}, {Name: "index", Type: field.TypeUint8}, {Name: "duration", Type: field.TypeString, Nullable: true}, {Name: "discounts", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "plan_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // PlanPhasesTable holds the schema information for the "plan_phases" table. PlanPhasesTable = &schema.Table{ Name: "plan_phases", Columns: PlanPhasesColumns, PrimaryKey: []*schema.Column{PlanPhasesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "plan_phases_plans_phases", Columns: []*schema.Column{PlanPhasesColumns[12]}, RefColumns: []*schema.Column{PlansColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "planphase_id", Unique: true, Columns: []*schema.Column{PlanPhasesColumns[0]}, }, { Name: "planphase_namespace", Unique: false, Columns: []*schema.Column{PlanPhasesColumns[1]}, }, { Name: "planphase_namespace_id", Unique: true, Columns: []*schema.Column{PlanPhasesColumns[1], PlanPhasesColumns[0]}, }, { Name: "planphase_namespace_key_deleted_at", Unique: true, Columns: []*schema.Column{PlanPhasesColumns[1], PlanPhasesColumns[8], PlanPhasesColumns[5]}, }, { Name: "planphase_namespace_key", Unique: false, Columns: []*schema.Column{PlanPhasesColumns[1], PlanPhasesColumns[8]}, }, { Name: "planphase_plan_id_key", Unique: true, Columns: []*schema.Column{PlanPhasesColumns[12], PlanPhasesColumns[8]}, Annotation: &entsql.IndexAnnotation{ Where: "deleted_at IS NULL", }, }, { Name: "planphase_plan_id_index", Unique: true, Columns: []*schema.Column{PlanPhasesColumns[12], PlanPhasesColumns[9]}, Annotation: &entsql.IndexAnnotation{ Where: "deleted_at IS NULL", }, }, }, } // PlanRateCardsColumns holds the columns for the "plan_rate_cards" table. PlanRateCardsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "name", Type: field.TypeString}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "key", Type: field.TypeString}, {Name: "type", Type: field.TypeEnum, Enums: []string{"flat_fee", "usage_based"}}, {Name: "feature_key", Type: field.TypeString, Nullable: true}, {Name: "entitlement_template", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "tax_config", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "billing_cadence", Type: field.TypeString, Nullable: true}, {Name: "price", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "feature_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "phase_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // PlanRateCardsTable holds the schema information for the "plan_rate_cards" table. PlanRateCardsTable = &schema.Table{ Name: "plan_rate_cards", Columns: PlanRateCardsColumns, PrimaryKey: []*schema.Column{PlanRateCardsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "plan_rate_cards_features_ratecard", Columns: []*schema.Column{PlanRateCardsColumns[15]}, RefColumns: []*schema.Column{FeaturesColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "plan_rate_cards_plan_phases_ratecards", Columns: []*schema.Column{PlanRateCardsColumns[16]}, RefColumns: []*schema.Column{PlanPhasesColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "planratecard_id", Unique: true, Columns: []*schema.Column{PlanRateCardsColumns[0]}, }, { Name: "planratecard_namespace", Unique: false, Columns: []*schema.Column{PlanRateCardsColumns[1]}, }, { Name: "planratecard_namespace_id", Unique: true, Columns: []*schema.Column{PlanRateCardsColumns[1], PlanRateCardsColumns[0]}, }, { Name: "planratecard_namespace_key_deleted_at", Unique: true, Columns: []*schema.Column{PlanRateCardsColumns[1], PlanRateCardsColumns[8], PlanRateCardsColumns[5]}, }, { Name: "planratecard_phase_id_key", Unique: true, Columns: []*schema.Column{PlanRateCardsColumns[16], PlanRateCardsColumns[8]}, Annotation: &entsql.IndexAnnotation{ Where: "deleted_at IS NULL", }, }, { Name: "planratecard_phase_id_feature_key", Unique: true, Columns: []*schema.Column{PlanRateCardsColumns[16], PlanRateCardsColumns[10]}, Annotation: &entsql.IndexAnnotation{ Where: "deleted_at IS NULL", }, }, }, } // SubscriptionsColumns holds the columns for the "subscriptions" table. SubscriptionsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "active_from", Type: field.TypeTime}, {Name: "active_to", Type: field.TypeTime, Nullable: true}, {Name: "billables_must_align", Type: field.TypeBool, Default: false}, {Name: "name", Type: field.TypeString, Default: "Subscription"}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "currency", Type: field.TypeString, Size: 3}, {Name: "customer_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "plan_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "char(26)"}}, } // SubscriptionsTable holds the schema information for the "subscriptions" table. SubscriptionsTable = &schema.Table{ Name: "subscriptions", Columns: SubscriptionsColumns, PrimaryKey: []*schema.Column{SubscriptionsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "subscriptions_customers_subscription", Columns: []*schema.Column{SubscriptionsColumns[12]}, RefColumns: []*schema.Column{CustomersColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "subscriptions_plans_subscriptions", Columns: []*schema.Column{SubscriptionsColumns[13]}, RefColumns: []*schema.Column{PlansColumns[0]}, OnDelete: schema.SetNull, }, }, Indexes: []*schema.Index{ { Name: "subscription_id", Unique: true, Columns: []*schema.Column{SubscriptionsColumns[0]}, }, { Name: "subscription_namespace", Unique: false, Columns: []*schema.Column{SubscriptionsColumns[1]}, }, { Name: "subscription_namespace_id", Unique: false, Columns: []*schema.Column{SubscriptionsColumns[1], SubscriptionsColumns[0]}, }, { Name: "subscription_namespace_customer_id", Unique: false, Columns: []*schema.Column{SubscriptionsColumns[1], SubscriptionsColumns[12]}, }, }, } // SubscriptionItemsColumns holds the columns for the "subscription_items" table. SubscriptionItemsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "active_from", Type: field.TypeTime}, {Name: "active_to", Type: field.TypeTime, Nullable: true}, {Name: "key", Type: field.TypeString}, {Name: "restarts_billing_period", Type: field.TypeBool, Nullable: true}, {Name: "active_from_override_relative_to_phase_start", Type: field.TypeString, Nullable: true}, {Name: "active_to_override_relative_to_phase_start", Type: field.TypeString, Nullable: true}, {Name: "name", Type: field.TypeString}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "feature_key", Type: field.TypeString, Nullable: true}, {Name: "entitlement_template", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "tax_config", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "billing_cadence", Type: field.TypeString, Nullable: true}, {Name: "price", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "entitlement_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "phase_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // SubscriptionItemsTable holds the schema information for the "subscription_items" table. SubscriptionItemsTable = &schema.Table{ Name: "subscription_items", Columns: SubscriptionItemsColumns, PrimaryKey: []*schema.Column{SubscriptionItemsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "subscription_items_entitlements_subscription_item", Columns: []*schema.Column{SubscriptionItemsColumns[19]}, RefColumns: []*schema.Column{EntitlementsColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "subscription_items_subscription_phases_items", Columns: []*schema.Column{SubscriptionItemsColumns[20]}, RefColumns: []*schema.Column{SubscriptionPhasesColumns[0]}, OnDelete: schema.NoAction, }, }, Indexes: []*schema.Index{ { Name: "subscriptionitem_id", Unique: true, Columns: []*schema.Column{SubscriptionItemsColumns[0]}, }, { Name: "subscriptionitem_namespace", Unique: false, Columns: []*schema.Column{SubscriptionItemsColumns[1]}, }, { Name: "subscriptionitem_namespace_id", Unique: false, Columns: []*schema.Column{SubscriptionItemsColumns[1], SubscriptionItemsColumns[0]}, }, { Name: "subscriptionitem_namespace_phase_id_key", Unique: false, Columns: []*schema.Column{SubscriptionItemsColumns[1], SubscriptionItemsColumns[20], SubscriptionItemsColumns[8]}, }, }, } // SubscriptionPhasesColumns holds the columns for the "subscription_phases" table. SubscriptionPhasesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "key", Type: field.TypeString}, {Name: "name", Type: field.TypeString}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "active_from", Type: field.TypeTime}, {Name: "subscription_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // SubscriptionPhasesTable holds the schema information for the "subscription_phases" table. SubscriptionPhasesTable = &schema.Table{ Name: "subscription_phases", Columns: SubscriptionPhasesColumns, PrimaryKey: []*schema.Column{SubscriptionPhasesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "subscription_phases_subscriptions_phases", Columns: []*schema.Column{SubscriptionPhasesColumns[10]}, RefColumns: []*schema.Column{SubscriptionsColumns[0]}, OnDelete: schema.NoAction, }, }, Indexes: []*schema.Index{ { Name: "subscriptionphase_id", Unique: true, Columns: []*schema.Column{SubscriptionPhasesColumns[0]}, }, { Name: "subscriptionphase_namespace", Unique: false, Columns: []*schema.Column{SubscriptionPhasesColumns[1]}, }, { Name: "subscriptionphase_namespace_id", Unique: false, Columns: []*schema.Column{SubscriptionPhasesColumns[1], SubscriptionPhasesColumns[0]}, }, { Name: "subscriptionphase_namespace_subscription_id", Unique: false, Columns: []*schema.Column{SubscriptionPhasesColumns[1], SubscriptionPhasesColumns[10]}, }, { Name: "subscriptionphase_namespace_subscription_id_key", Unique: false, Columns: []*schema.Column{SubscriptionPhasesColumns[1], SubscriptionPhasesColumns[10], SubscriptionPhasesColumns[6]}, }, }, } // UsageResetsColumns holds the columns for the "usage_resets" table. UsageResetsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "reset_time", Type: field.TypeTime}, {Name: "anchor", Type: field.TypeTime}, {Name: "entitlement_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // UsageResetsTable holds the schema information for the "usage_resets" table. UsageResetsTable = &schema.Table{ Name: "usage_resets", Columns: UsageResetsColumns, PrimaryKey: []*schema.Column{UsageResetsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "usage_resets_entitlements_usage_reset", Columns: []*schema.Column{UsageResetsColumns[7]}, RefColumns: []*schema.Column{EntitlementsColumns[0]}, OnDelete: schema.NoAction, }, }, Indexes: []*schema.Index{ { Name: "usagereset_id", Unique: true, Columns: []*schema.Column{UsageResetsColumns[0]}, }, { Name: "usagereset_namespace", Unique: false, Columns: []*schema.Column{UsageResetsColumns[1]}, }, { Name: "usagereset_namespace_entitlement_id", Unique: false, Columns: []*schema.Column{UsageResetsColumns[1], UsageResetsColumns[7]}, }, { Name: "usagereset_namespace_entitlement_id_reset_time", Unique: false, Columns: []*schema.Column{UsageResetsColumns[1], UsageResetsColumns[7], UsageResetsColumns[5]}, }, }, } // NotificationChannelRulesColumns holds the columns for the "notification_channel_rules" table. NotificationChannelRulesColumns = []*schema.Column{ {Name: "notification_channel_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "notification_rule_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // NotificationChannelRulesTable holds the schema information for the "notification_channel_rules" table. NotificationChannelRulesTable = &schema.Table{ Name: "notification_channel_rules", Columns: NotificationChannelRulesColumns, PrimaryKey: []*schema.Column{NotificationChannelRulesColumns[0], NotificationChannelRulesColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "notification_channel_rules_notification_channel_id", Columns: []*schema.Column{NotificationChannelRulesColumns[0]}, RefColumns: []*schema.Column{NotificationChannelsColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "notification_channel_rules_notification_rule_id", Columns: []*schema.Column{NotificationChannelRulesColumns[1]}, RefColumns: []*schema.Column{NotificationRulesColumns[0]}, OnDelete: schema.Cascade, }, }, } // NotificationEventDeliveryStatusEventsColumns holds the columns for the "notification_event_delivery_status_events" table. NotificationEventDeliveryStatusEventsColumns = []*schema.Column{ {Name: "notification_event_delivery_status_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "notification_event_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // NotificationEventDeliveryStatusEventsTable holds the schema information for the "notification_event_delivery_status_events" table. NotificationEventDeliveryStatusEventsTable = &schema.Table{ Name: "notification_event_delivery_status_events", Columns: NotificationEventDeliveryStatusEventsColumns, PrimaryKey: []*schema.Column{NotificationEventDeliveryStatusEventsColumns[0], NotificationEventDeliveryStatusEventsColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "notification_event_delivery_status_events_notification_event_delivery_status_id", Columns: []*schema.Column{NotificationEventDeliveryStatusEventsColumns[0]}, RefColumns: []*schema.Column{NotificationEventDeliveryStatusColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "notification_event_delivery_status_events_notification_event_id", Columns: []*schema.Column{NotificationEventDeliveryStatusEventsColumns[1]}, RefColumns: []*schema.Column{NotificationEventsColumns[0]}, OnDelete: schema.Cascade, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ AppsTable, AppCustomersTable, AppStripesTable, AppStripeCustomersTable, BalanceSnapshotsTable, BillingCustomerLocksTable, BillingCustomerOverridesTable, BillingInvoicesTable, BillingInvoiceDiscountsTable, BillingInvoiceFlatFeeLineConfigsTable, BillingInvoiceLinesTable, BillingInvoiceLineDiscountsTable, BillingInvoiceUsageBasedLineConfigsTable, BillingInvoiceValidationIssuesTable, BillingProfilesTable, BillingSequenceNumbersTable, BillingWorkflowConfigsTable, CustomersTable, CustomerSubjectsTable, EntitlementsTable, FeaturesTable, GrantsTable, MetersTable, NotificationChannelsTable, NotificationEventsTable, NotificationEventDeliveryStatusTable, NotificationRulesTable, PlansTable, PlanPhasesTable, PlanRateCardsTable, SubscriptionsTable, SubscriptionItemsTable, SubscriptionPhasesTable, UsageResetsTable, NotificationChannelRulesTable, NotificationEventDeliveryStatusEventsTable, } )
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 (*Schema) Diff ¶
Diff creates a migration file containing the statements to resolve the diff between the Ent schema and the connected database.
func (*Schema) NamedDiff ¶
NamedDiff creates a named migration file containing the statements to resolve the diff between the Ent schema and the connected database.
Click to show internal directories.
Click to hide internal directories.