migrate

package
v1.18.14 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: BSD-3-Clause 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 (
	// CampusesColumns holds the columns for the "campuses" table.
	CampusesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name_fold", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "aka", Type: field.TypeString, Nullable: true},
		{Name: "city", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "country", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "logo", Type: field.TypeString, Nullable: true},
		{Name: "name", Type: field.TypeString},
		{Name: "name_long", Type: field.TypeString, Nullable: true},
		{Name: "notes", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "social_media", Type: field.TypeJSON, Nullable: true},
		{Name: "state", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "website", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "zipcode", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "org_name", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "created", Type: field.TypeTime},
		{Name: "updated", Type: field.TypeTime},
		{Name: "status", Type: field.TypeString, Default: "ok"},
		{Name: "org_id", Type: field.TypeInt, Nullable: true},
	}
	// CampusesTable holds the schema information for the "campuses" table.
	CampusesTable = &schema.Table{
		Name:       "campuses",
		Columns:    CampusesColumns,
		PrimaryKey: []*schema.Column{CampusesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "campuses_organizations_campuses",
				Columns:    []*schema.Column{CampusesColumns[17]},
				RefColumns: []*schema.Column{OrganizationsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "campus_name",
				Unique:  false,
				Columns: []*schema.Column{CampusesColumns[6]},
			},
			{
				Name:    "campus_org_id",
				Unique:  false,
				Columns: []*schema.Column{CampusesColumns[17]},
			},
			{
				Name:    "campus_status",
				Unique:  false,
				Columns: []*schema.Column{CampusesColumns[16]},
			},
			{
				Name:    "campus_updated",
				Unique:  false,
				Columns: []*schema.Column{CampusesColumns[15]},
			},
		},
	}
	// CarriersColumns holds the columns for the "carriers" table.
	CarriersColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name_fold", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "aka_fold", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "aka", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "logo", Type: field.TypeString, Nullable: true},
		{Name: "name", Type: field.TypeString},
		{Name: "name_long", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "notes", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "social_media", Type: field.TypeJSON, Nullable: true},
		{Name: "website", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "org_name", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "fac_count", Type: field.TypeInt, Nullable: true, Default: 0},
		{Name: "created", Type: field.TypeTime},
		{Name: "updated", Type: field.TypeTime},
		{Name: "status", Type: field.TypeString, Default: "ok"},
		{Name: "org_id", Type: field.TypeInt, Nullable: true},
	}
	// CarriersTable holds the schema information for the "carriers" table.
	CarriersTable = &schema.Table{
		Name:       "carriers",
		Columns:    CarriersColumns,
		PrimaryKey: []*schema.Column{CarriersColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "carriers_organizations_carriers",
				Columns:    []*schema.Column{CarriersColumns[15]},
				RefColumns: []*schema.Column{OrganizationsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "carrier_name",
				Unique:  false,
				Columns: []*schema.Column{CarriersColumns[5]},
			},
			{
				Name:    "carrier_org_id",
				Unique:  false,
				Columns: []*schema.Column{CarriersColumns[15]},
			},
			{
				Name:    "carrier_status",
				Unique:  false,
				Columns: []*schema.Column{CarriersColumns[14]},
			},
			{
				Name:    "carrier_updated",
				Unique:  false,
				Columns: []*schema.Column{CarriersColumns[13]},
			},
		},
	}
	// CarrierFacilitiesColumns holds the columns for the "carrier_facilities" table.
	CarrierFacilitiesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "created", Type: field.TypeTime},
		{Name: "updated", Type: field.TypeTime},
		{Name: "status", Type: field.TypeString, Default: "ok"},
		{Name: "carrier_id", Type: field.TypeInt, Nullable: true},
		{Name: "fac_id", Type: field.TypeInt, Nullable: true},
	}
	// CarrierFacilitiesTable holds the schema information for the "carrier_facilities" table.
	CarrierFacilitiesTable = &schema.Table{
		Name:       "carrier_facilities",
		Columns:    CarrierFacilitiesColumns,
		PrimaryKey: []*schema.Column{CarrierFacilitiesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "carrier_facilities_carriers_carrier_facilities",
				Columns:    []*schema.Column{CarrierFacilitiesColumns[5]},
				RefColumns: []*schema.Column{CarriersColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "carrier_facilities_facilities_carrier_facilities",
				Columns:    []*schema.Column{CarrierFacilitiesColumns[6]},
				RefColumns: []*schema.Column{FacilitiesColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "carrierfacility_carrier_id",
				Unique:  false,
				Columns: []*schema.Column{CarrierFacilitiesColumns[5]},
			},
			{
				Name:    "carrierfacility_fac_id",
				Unique:  false,
				Columns: []*schema.Column{CarrierFacilitiesColumns[6]},
			},
			{
				Name:    "carrierfacility_status",
				Unique:  false,
				Columns: []*schema.Column{CarrierFacilitiesColumns[4]},
			},
			{
				Name:    "carrierfacility_updated",
				Unique:  false,
				Columns: []*schema.Column{CarrierFacilitiesColumns[3]},
			},
		},
	}
	// FacilitiesColumns holds the columns for the "facilities" table.
	FacilitiesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name_fold", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "aka_fold", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "city_fold", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "address1", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "address2", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "aka", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "available_voltage_services", Type: field.TypeJSON, Nullable: true},
		{Name: "city", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "clli", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "country", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "diverse_serving_substations", Type: field.TypeBool, Nullable: true},
		{Name: "floor", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "latitude", Type: field.TypeFloat64, Nullable: true},
		{Name: "logo", Type: field.TypeString, Nullable: true},
		{Name: "longitude", Type: field.TypeFloat64, Nullable: true},
		{Name: "name", Type: field.TypeString},
		{Name: "name_long", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "notes", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "npanxx", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "property", Type: field.TypeString, Nullable: true},
		{Name: "region_continent", Type: field.TypeString, Nullable: true},
		{Name: "rencode", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "sales_email", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "sales_phone", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "social_media", Type: field.TypeJSON, Nullable: true},
		{Name: "state", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "status_dashboard", Type: field.TypeString, Nullable: true},
		{Name: "suite", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "tech_email", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "tech_phone", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "website", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "zipcode", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "org_name", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "net_count", Type: field.TypeInt, Nullable: true, Default: 0},
		{Name: "ix_count", Type: field.TypeInt, Nullable: true, Default: 0},
		{Name: "carrier_count", Type: field.TypeInt, Nullable: true, Default: 0},
		{Name: "created", Type: field.TypeTime},
		{Name: "updated", Type: field.TypeTime},
		{Name: "status", Type: field.TypeString, Default: "ok"},
		{Name: "campus_id", Type: field.TypeInt, Nullable: true},
		{Name: "org_id", Type: field.TypeInt, Nullable: true},
	}
	// FacilitiesTable holds the schema information for the "facilities" table.
	FacilitiesTable = &schema.Table{
		Name:       "facilities",
		Columns:    FacilitiesColumns,
		PrimaryKey: []*schema.Column{FacilitiesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "facilities_campuses_facilities",
				Columns:    []*schema.Column{FacilitiesColumns[40]},
				RefColumns: []*schema.Column{CampusesColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "facilities_organizations_facilities",
				Columns:    []*schema.Column{FacilitiesColumns[41]},
				RefColumns: []*schema.Column{OrganizationsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "facility_campus_id",
				Unique:  false,
				Columns: []*schema.Column{FacilitiesColumns[40]},
			},
			{
				Name:    "facility_name",
				Unique:  false,
				Columns: []*schema.Column{FacilitiesColumns[16]},
			},
			{
				Name:    "facility_org_id",
				Unique:  false,
				Columns: []*schema.Column{FacilitiesColumns[41]},
			},
			{
				Name:    "facility_status",
				Unique:  false,
				Columns: []*schema.Column{FacilitiesColumns[39]},
			},
			{
				Name:    "facility_updated",
				Unique:  false,
				Columns: []*schema.Column{FacilitiesColumns[38]},
			},
		},
	}
	// InternetExchangesColumns holds the columns for the "internet_exchanges" table.
	InternetExchangesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name_fold", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "aka_fold", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "name_long_fold", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "city_fold", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "aka", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "city", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "country", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "ixf_last_import", Type: field.TypeTime, Nullable: true},
		{Name: "ixf_net_count", Type: field.TypeInt, Nullable: true, Default: 0},
		{Name: "logo", Type: field.TypeString, Nullable: true},
		{Name: "media", Type: field.TypeString, Nullable: true, Default: "Ethernet"},
		{Name: "name", Type: field.TypeString},
		{Name: "name_long", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "notes", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "policy_email", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "policy_phone", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "proto_ipv6", Type: field.TypeBool, Default: false},
		{Name: "proto_multicast", Type: field.TypeBool, Default: false},
		{Name: "proto_unicast", Type: field.TypeBool, Default: false},
		{Name: "region_continent", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "sales_email", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "sales_phone", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "service_level", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "social_media", Type: field.TypeJSON, Nullable: true},
		{Name: "status_dashboard", Type: field.TypeString, Nullable: true},
		{Name: "tech_email", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "tech_phone", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "terms", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "url_stats", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "website", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "net_count", Type: field.TypeInt, Nullable: true, Default: 0},
		{Name: "fac_count", Type: field.TypeInt, Nullable: true, Default: 0},
		{Name: "ixf_import_request", Type: field.TypeString, Nullable: true},
		{Name: "ixf_import_request_status", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "created", Type: field.TypeTime},
		{Name: "updated", Type: field.TypeTime},
		{Name: "status", Type: field.TypeString, Default: "ok"},
		{Name: "org_id", Type: field.TypeInt, Nullable: true},
	}
	// InternetExchangesTable holds the schema information for the "internet_exchanges" table.
	InternetExchangesTable = &schema.Table{
		Name:       "internet_exchanges",
		Columns:    InternetExchangesColumns,
		PrimaryKey: []*schema.Column{InternetExchangesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "internet_exchanges_organizations_internet_exchanges",
				Columns:    []*schema.Column{InternetExchangesColumns[38]},
				RefColumns: []*schema.Column{OrganizationsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "internetexchange_name",
				Unique:  false,
				Columns: []*schema.Column{InternetExchangesColumns[12]},
			},
			{
				Name:    "internetexchange_org_id",
				Unique:  false,
				Columns: []*schema.Column{InternetExchangesColumns[38]},
			},
			{
				Name:    "internetexchange_status",
				Unique:  false,
				Columns: []*schema.Column{InternetExchangesColumns[37]},
			},
			{
				Name:    "internetexchange_updated",
				Unique:  false,
				Columns: []*schema.Column{InternetExchangesColumns[36]},
			},
		},
	}
	// IxFacilitiesColumns holds the columns for the "ix_facilities" table.
	IxFacilitiesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "city", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "country", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "created", Type: field.TypeTime},
		{Name: "updated", Type: field.TypeTime},
		{Name: "status", Type: field.TypeString, Default: "ok"},
		{Name: "fac_id", Type: field.TypeInt, Nullable: true},
		{Name: "ix_id", Type: field.TypeInt, Nullable: true},
	}
	// IxFacilitiesTable holds the schema information for the "ix_facilities" table.
	IxFacilitiesTable = &schema.Table{
		Name:       "ix_facilities",
		Columns:    IxFacilitiesColumns,
		PrimaryKey: []*schema.Column{IxFacilitiesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "ix_facilities_facilities_ix_facilities",
				Columns:    []*schema.Column{IxFacilitiesColumns[7]},
				RefColumns: []*schema.Column{FacilitiesColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "ix_facilities_internet_exchanges_ix_facilities",
				Columns:    []*schema.Column{IxFacilitiesColumns[8]},
				RefColumns: []*schema.Column{InternetExchangesColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "ixfacility_fac_id",
				Unique:  false,
				Columns: []*schema.Column{IxFacilitiesColumns[7]},
			},
			{
				Name:    "ixfacility_ix_id",
				Unique:  false,
				Columns: []*schema.Column{IxFacilitiesColumns[8]},
			},
			{
				Name:    "ixfacility_status",
				Unique:  false,
				Columns: []*schema.Column{IxFacilitiesColumns[6]},
			},
			{
				Name:    "ixfacility_updated",
				Unique:  false,
				Columns: []*schema.Column{IxFacilitiesColumns[5]},
			},
		},
	}
	// IxLansColumns holds the columns for the "ix_lans" table.
	IxLansColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "arp_sponge", Type: field.TypeString, Nullable: true},
		{Name: "descr", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "dot1q_support", Type: field.TypeBool, Default: false},
		{Name: "ixf_ixp_import_enabled", Type: field.TypeBool, Default: false},
		{Name: "ixf_ixp_member_list_url", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "ixf_ixp_member_list_url_visible", Type: field.TypeString, Nullable: true, Default: "Private"},
		{Name: "mtu", Type: field.TypeInt, Nullable: true, Default: 1500},
		{Name: "name", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "rs_asn", Type: field.TypeInt, Nullable: true, Default: 0},
		{Name: "created", Type: field.TypeTime},
		{Name: "updated", Type: field.TypeTime},
		{Name: "status", Type: field.TypeString, Default: "ok"},
		{Name: "ix_id", Type: field.TypeInt, Nullable: true},
	}
	// IxLansTable holds the schema information for the "ix_lans" table.
	IxLansTable = &schema.Table{
		Name:       "ix_lans",
		Columns:    IxLansColumns,
		PrimaryKey: []*schema.Column{IxLansColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "ix_lans_internet_exchanges_ix_lans",
				Columns:    []*schema.Column{IxLansColumns[13]},
				RefColumns: []*schema.Column{InternetExchangesColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "ixlan_ix_id",
				Unique:  false,
				Columns: []*schema.Column{IxLansColumns[13]},
			},
			{
				Name:    "ixlan_name",
				Unique:  false,
				Columns: []*schema.Column{IxLansColumns[8]},
			},
			{
				Name:    "ixlan_status",
				Unique:  false,
				Columns: []*schema.Column{IxLansColumns[12]},
			},
			{
				Name:    "ixlan_updated",
				Unique:  false,
				Columns: []*schema.Column{IxLansColumns[11]},
			},
		},
	}
	// IxPrefixesColumns holds the columns for the "ix_prefixes" table.
	IxPrefixesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "in_dfz", Type: field.TypeBool, Default: false},
		{Name: "prefix", Type: field.TypeString},
		{Name: "protocol", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "created", Type: field.TypeTime},
		{Name: "updated", Type: field.TypeTime},
		{Name: "status", Type: field.TypeString, Default: "ok"},
		{Name: "ixlan_id", Type: field.TypeInt, Nullable: true},
	}
	// IxPrefixesTable holds the schema information for the "ix_prefixes" table.
	IxPrefixesTable = &schema.Table{
		Name:       "ix_prefixes",
		Columns:    IxPrefixesColumns,
		PrimaryKey: []*schema.Column{IxPrefixesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "ix_prefixes_ix_lans_ix_prefixes",
				Columns:    []*schema.Column{IxPrefixesColumns[7]},
				RefColumns: []*schema.Column{IxLansColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "ixprefix_ixlan_id",
				Unique:  false,
				Columns: []*schema.Column{IxPrefixesColumns[7]},
			},
			{
				Name:    "ixprefix_prefix",
				Unique:  false,
				Columns: []*schema.Column{IxPrefixesColumns[2]},
			},
			{
				Name:    "ixprefix_status",
				Unique:  false,
				Columns: []*schema.Column{IxPrefixesColumns[6]},
			},
			{
				Name:    "ixprefix_updated",
				Unique:  false,
				Columns: []*schema.Column{IxPrefixesColumns[5]},
			},
		},
	}
	// NetworksColumns holds the columns for the "networks" table.
	NetworksColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name_fold", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "aka_fold", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "name_long_fold", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "aka", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "allow_ixp_update", Type: field.TypeBool, Default: false},
		{Name: "asn", Type: field.TypeInt, Unique: true},
		{Name: "info_ipv6", Type: field.TypeBool, Default: false},
		{Name: "info_multicast", Type: field.TypeBool, Default: false},
		{Name: "info_never_via_route_servers", Type: field.TypeBool, Default: false},
		{Name: "info_prefixes4", Type: field.TypeInt, Nullable: true},
		{Name: "info_prefixes6", Type: field.TypeInt, Nullable: true},
		{Name: "info_ratio", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "info_scope", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "info_traffic", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "info_type", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "info_types", Type: field.TypeJSON, Nullable: true},
		{Name: "info_unicast", Type: field.TypeBool, Default: false},
		{Name: "irr_as_set", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "logo", Type: field.TypeString, Nullable: true},
		{Name: "looking_glass", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "name", Type: field.TypeString},
		{Name: "name_long", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "notes", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "policy_contracts", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "policy_general", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "policy_locations", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "policy_ratio", Type: field.TypeBool, Default: false},
		{Name: "policy_url", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "rir_status", Type: field.TypeString, Nullable: true},
		{Name: "rir_status_updated", Type: field.TypeTime, Nullable: true},
		{Name: "route_server", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "social_media", Type: field.TypeJSON, Nullable: true},
		{Name: "status_dashboard", Type: field.TypeString, Nullable: true},
		{Name: "website", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "ix_count", Type: field.TypeInt, Nullable: true, Default: 0},
		{Name: "fac_count", Type: field.TypeInt, Nullable: true, Default: 0},
		{Name: "netixlan_updated", Type: field.TypeTime, Nullable: true},
		{Name: "netfac_updated", Type: field.TypeTime, Nullable: true},
		{Name: "poc_updated", Type: field.TypeTime, Nullable: true},
		{Name: "created", Type: field.TypeTime},
		{Name: "updated", Type: field.TypeTime},
		{Name: "status", Type: field.TypeString, Default: "ok"},
		{Name: "org_id", Type: field.TypeInt, Nullable: true},
	}
	// NetworksTable holds the schema information for the "networks" table.
	NetworksTable = &schema.Table{
		Name:       "networks",
		Columns:    NetworksColumns,
		PrimaryKey: []*schema.Column{NetworksColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "networks_organizations_networks",
				Columns:    []*schema.Column{NetworksColumns[43]},
				RefColumns: []*schema.Column{OrganizationsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "network_asn",
				Unique:  false,
				Columns: []*schema.Column{NetworksColumns[6]},
			},
			{
				Name:    "network_name",
				Unique:  false,
				Columns: []*schema.Column{NetworksColumns[21]},
			},
			{
				Name:    "network_org_id",
				Unique:  false,
				Columns: []*schema.Column{NetworksColumns[43]},
			},
			{
				Name:    "network_status",
				Unique:  false,
				Columns: []*schema.Column{NetworksColumns[42]},
			},
			{
				Name:    "network_updated",
				Unique:  false,
				Columns: []*schema.Column{NetworksColumns[41]},
			},
		},
	}
	// NetworkFacilitiesColumns holds the columns for the "network_facilities" table.
	NetworkFacilitiesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "local_asn", Type: field.TypeInt},
		{Name: "name", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "city", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "country", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "created", Type: field.TypeTime},
		{Name: "updated", Type: field.TypeTime},
		{Name: "status", Type: field.TypeString, Default: "ok"},
		{Name: "fac_id", Type: field.TypeInt, Nullable: true},
		{Name: "net_id", Type: field.TypeInt, Nullable: true},
	}
	// NetworkFacilitiesTable holds the schema information for the "network_facilities" table.
	NetworkFacilitiesTable = &schema.Table{
		Name:       "network_facilities",
		Columns:    NetworkFacilitiesColumns,
		PrimaryKey: []*schema.Column{NetworkFacilitiesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "network_facilities_facilities_network_facilities",
				Columns:    []*schema.Column{NetworkFacilitiesColumns[8]},
				RefColumns: []*schema.Column{FacilitiesColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "network_facilities_networks_network_facilities",
				Columns:    []*schema.Column{NetworkFacilitiesColumns[9]},
				RefColumns: []*schema.Column{NetworksColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "networkfacility_fac_id",
				Unique:  false,
				Columns: []*schema.Column{NetworkFacilitiesColumns[8]},
			},
			{
				Name:    "networkfacility_net_id",
				Unique:  false,
				Columns: []*schema.Column{NetworkFacilitiesColumns[9]},
			},
			{
				Name:    "networkfacility_status",
				Unique:  false,
				Columns: []*schema.Column{NetworkFacilitiesColumns[7]},
			},
			{
				Name:    "networkfacility_updated",
				Unique:  false,
				Columns: []*schema.Column{NetworkFacilitiesColumns[6]},
			},
		},
	}
	// NetworkIxLansColumns holds the columns for the "network_ix_lans" table.
	NetworkIxLansColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "ix_side_id", Type: field.TypeInt, Nullable: true},
		{Name: "net_side_id", Type: field.TypeInt, Nullable: true},
		{Name: "asn", Type: field.TypeInt},
		{Name: "bfd_support", Type: field.TypeBool, Default: false},
		{Name: "ipaddr4", Type: field.TypeString, Nullable: true},
		{Name: "ipaddr6", Type: field.TypeString, Nullable: true},
		{Name: "is_rs_peer", Type: field.TypeBool, Default: false},
		{Name: "notes", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "operational", Type: field.TypeBool, Default: true},
		{Name: "speed", Type: field.TypeInt},
		{Name: "ix_id", Type: field.TypeInt, Nullable: true},
		{Name: "name", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "created", Type: field.TypeTime},
		{Name: "updated", Type: field.TypeTime},
		{Name: "status", Type: field.TypeString, Default: "ok"},
		{Name: "ixlan_id", Type: field.TypeInt, Nullable: true},
		{Name: "net_id", Type: field.TypeInt, Nullable: true},
	}
	// NetworkIxLansTable holds the schema information for the "network_ix_lans" table.
	NetworkIxLansTable = &schema.Table{
		Name:       "network_ix_lans",
		Columns:    NetworkIxLansColumns,
		PrimaryKey: []*schema.Column{NetworkIxLansColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "network_ix_lans_ix_lans_network_ix_lans",
				Columns:    []*schema.Column{NetworkIxLansColumns[16]},
				RefColumns: []*schema.Column{IxLansColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "network_ix_lans_networks_network_ix_lans",
				Columns:    []*schema.Column{NetworkIxLansColumns[17]},
				RefColumns: []*schema.Column{NetworksColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "networkixlan_ix_side_id",
				Unique:  false,
				Columns: []*schema.Column{NetworkIxLansColumns[1]},
			},
			{
				Name:    "networkixlan_ixlan_id",
				Unique:  false,
				Columns: []*schema.Column{NetworkIxLansColumns[16]},
			},
			{
				Name:    "networkixlan_net_id",
				Unique:  false,
				Columns: []*schema.Column{NetworkIxLansColumns[17]},
			},
			{
				Name:    "networkixlan_net_side_id",
				Unique:  false,
				Columns: []*schema.Column{NetworkIxLansColumns[2]},
			},
			{
				Name:    "networkixlan_status",
				Unique:  false,
				Columns: []*schema.Column{NetworkIxLansColumns[15]},
			},
			{
				Name:    "networkixlan_updated",
				Unique:  false,
				Columns: []*schema.Column{NetworkIxLansColumns[14]},
			},
		},
	}
	// OrganizationsColumns holds the columns for the "organizations" table.
	OrganizationsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name_fold", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "aka_fold", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "city_fold", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "address1", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "address2", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "aka", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "city", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "country", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "floor", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "latitude", Type: field.TypeFloat64, Nullable: true},
		{Name: "logo", Type: field.TypeString, Nullable: true},
		{Name: "longitude", Type: field.TypeFloat64, Nullable: true},
		{Name: "name", Type: field.TypeString},
		{Name: "name_long", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "notes", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "social_media", Type: field.TypeJSON, Nullable: true},
		{Name: "state", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "suite", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "website", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "zipcode", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "created", Type: field.TypeTime},
		{Name: "updated", Type: field.TypeTime},
		{Name: "status", Type: field.TypeString, Default: "ok"},
	}
	// OrganizationsTable holds the schema information for the "organizations" table.
	OrganizationsTable = &schema.Table{
		Name:       "organizations",
		Columns:    OrganizationsColumns,
		PrimaryKey: []*schema.Column{OrganizationsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "organization_name",
				Unique:  false,
				Columns: []*schema.Column{OrganizationsColumns[13]},
			},
			{
				Name:    "organization_status",
				Unique:  false,
				Columns: []*schema.Column{OrganizationsColumns[23]},
			},
			{
				Name:    "organization_updated",
				Unique:  false,
				Columns: []*schema.Column{OrganizationsColumns[22]},
			},
		},
	}
	// PocsColumns holds the columns for the "pocs" table.
	PocsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "email", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "name", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "phone", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "role", Type: field.TypeString},
		{Name: "url", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "visible", Type: field.TypeString, Nullable: true, Default: "Public"},
		{Name: "created", Type: field.TypeTime},
		{Name: "updated", Type: field.TypeTime},
		{Name: "status", Type: field.TypeString, Default: "ok"},
		{Name: "net_id", Type: field.TypeInt, Nullable: true},
	}
	// PocsTable holds the schema information for the "pocs" table.
	PocsTable = &schema.Table{
		Name:       "pocs",
		Columns:    PocsColumns,
		PrimaryKey: []*schema.Column{PocsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "pocs_networks_pocs",
				Columns:    []*schema.Column{PocsColumns[10]},
				RefColumns: []*schema.Column{NetworksColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "poc_name",
				Unique:  false,
				Columns: []*schema.Column{PocsColumns[2]},
			},
			{
				Name:    "poc_net_id",
				Unique:  false,
				Columns: []*schema.Column{PocsColumns[10]},
			},
			{
				Name:    "poc_role",
				Unique:  false,
				Columns: []*schema.Column{PocsColumns[4]},
			},
			{
				Name:    "poc_status",
				Unique:  false,
				Columns: []*schema.Column{PocsColumns[9]},
			},
			{
				Name:    "poc_updated",
				Unique:  false,
				Columns: []*schema.Column{PocsColumns[8]},
			},
		},
	}
	// Tables holds all the tables in the schema.
	Tables = []*schema.Table{
		CampusesTable,
		CarriersTable,
		CarrierFacilitiesTable,
		FacilitiesTable,
		InternetExchangesTable,
		IxFacilitiesTable,
		IxLansTable,
		IxPrefixesTable,
		NetworksTable,
		NetworkFacilitiesTable,
		NetworkIxLansTable,
		OrganizationsTable,
		PocsTable,
	}
)

Functions

func Create

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

Create creates all table resources using the given schema driver.

Types

type Schema

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

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

func NewSchema

func NewSchema(drv dialect.Driver) *Schema

NewSchema creates a new schema client.

func (*Schema) Create

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

Create creates all schema resources.

func (*Schema) WriteTo

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

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

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

Jump to

Keyboard shortcuts

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