migrate

package
v0.0.0-...-6edac6f Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2020 License: MIT Imports: 6 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
	// WithFixture sets the foreign-key renaming option to the migration when upgrading
	// ent from v0.1.0 (issue-#285). Defaults to true.
	WithFixture = schema.WithFixture
)
View Source
var (
	// ActionsColumns holds the columns for the "actions" table.
	ActionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "action", Type: field.TypeString},
		{Name: "category", Type: field.TypeString},
		{Name: "label", Type: field.TypeString, Nullable: true},
		{Name: "property", Type: field.TypeString, Nullable: true},
		{Name: "value", Type: field.TypeBytes, Nullable: true},
		{Name: "event_action", Type: field.TypeUUID, Unique: true, Nullable: true},
	}
	// ActionsTable holds the schema information for the "actions" table.
	ActionsTable = &schema.Table{
		Name:       "actions",
		Columns:    ActionsColumns,
		PrimaryKey: []*schema.Column{ActionsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:  "actions_events_action",
				Columns: []*schema.Column{ActionsColumns[6]},

				RefColumns: []*schema.Column{EventsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// AliasColumns holds the columns for the "alias" table.
	AliasColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "from", Type: field.TypeString},
		{Name: "to", Type: field.TypeString},
		{Name: "event_alias", Type: field.TypeUUID, Unique: true, Nullable: true},
		{Name: "user_aliases", Type: field.TypeString, Nullable: true},
	}
	// AliasTable holds the schema information for the "alias" table.
	AliasTable = &schema.Table{
		Name:       "alias",
		Columns:    AliasColumns,
		PrimaryKey: []*schema.Column{AliasColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:  "alias_events_alias",
				Columns: []*schema.Column{AliasColumns[3]},

				RefColumns: []*schema.Column{EventsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:  "alias_users_aliases",
				Columns: []*schema.Column{AliasColumns[4]},

				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// AppsColumns holds the columns for the "apps" table.
	AppsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name", Type: field.TypeString},
		{Name: "version", Type: field.TypeString, Nullable: true},
		{Name: "build", Type: field.TypeString, Nullable: true},
		{Name: "namespace", Type: field.TypeString, Nullable: true},
		{Name: "properties", Type: field.TypeJSON, Nullable: true},
	}
	// AppsTable holds the schema information for the "apps" table.
	AppsTable = &schema.Table{
		Name:        "apps",
		Columns:     AppsColumns,
		PrimaryKey:  []*schema.Column{AppsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{},
		Indexes: []*schema.Index{
			{
				Name:    "app_name_version_build",
				Unique:  true,
				Columns: []*schema.Column{AppsColumns[1], AppsColumns[2], AppsColumns[3]},
			},
		},
	}
	// BrowsersColumns holds the columns for the "browsers" table.
	BrowsersColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name", Type: field.TypeString},
		{Name: "version", Type: field.TypeString},
		{Name: "useragent", Type: field.TypeString, Nullable: true},
		{Name: "event_browser", Type: field.TypeUUID, Unique: true, Nullable: true},
	}
	// BrowsersTable holds the schema information for the "browsers" table.
	BrowsersTable = &schema.Table{
		Name:       "browsers",
		Columns:    BrowsersColumns,
		PrimaryKey: []*schema.Column{BrowsersColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:  "browsers_events_browser",
				Columns: []*schema.Column{BrowsersColumns[4]},

				RefColumns: []*schema.Column{EventsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// CampaignsColumns holds the columns for the "campaigns" table.
	CampaignsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name", Type: field.TypeString},
		{Name: "source", Type: field.TypeString, Nullable: true},
		{Name: "medium", Type: field.TypeString, Nullable: true},
		{Name: "term", Type: field.TypeString, Nullable: true},
		{Name: "content", Type: field.TypeString, Nullable: true},
	}
	// CampaignsTable holds the schema information for the "campaigns" table.
	CampaignsTable = &schema.Table{
		Name:        "campaigns",
		Columns:     CampaignsColumns,
		PrimaryKey:  []*schema.Column{CampaignsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{},
	}
	// ConnectivitiesColumns holds the columns for the "connectivities" table.
	ConnectivitiesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "bluetooth", Type: field.TypeBool},
		{Name: "cellular", Type: field.TypeBool},
		{Name: "wifi", Type: field.TypeBool},
		{Name: "ethernet", Type: field.TypeBool},
		{Name: "carrier", Type: field.TypeBool},
		{Name: "isp", Type: field.TypeBool},
		{Name: "event_connectivity", Type: field.TypeUUID, Unique: true, Nullable: true},
	}
	// ConnectivitiesTable holds the schema information for the "connectivities" table.
	ConnectivitiesTable = &schema.Table{
		Name:       "connectivities",
		Columns:    ConnectivitiesColumns,
		PrimaryKey: []*schema.Column{ConnectivitiesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:  "connectivities_events_connectivity",
				Columns: []*schema.Column{ConnectivitiesColumns[7]},

				RefColumns: []*schema.Column{EventsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// DevicesColumns holds the columns for the "devices" table.
	DevicesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString},
		{Name: "manufacturer", Type: field.TypeString, Nullable: true},
		{Name: "model", Type: field.TypeString, Nullable: true},
		{Name: "name", Type: field.TypeString, Nullable: true},
		{Name: "type", Type: field.TypeString, Nullable: true},
		{Name: "version", Type: field.TypeString, Nullable: true},
		{Name: "mobile", Type: field.TypeBool, Nullable: true},
		{Name: "tablet", Type: field.TypeBool, Nullable: true},
		{Name: "desktop", Type: field.TypeBool, Nullable: true},
		{Name: "properties", Type: field.TypeJSON, Nullable: true},
	}
	// DevicesTable holds the schema information for the "devices" table.
	DevicesTable = &schema.Table{
		Name:        "devices",
		Columns:     DevicesColumns,
		PrimaryKey:  []*schema.Column{DevicesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{},
	}
	// EventsColumns holds the columns for the "events" table.
	EventsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "tracking_id", Type: field.TypeString},
		{Name: "event", Type: field.TypeEnum, Enums: []string{"action", "alias", "group", "identify", "pageview", "screenview", "session", "timing", "transaction"}},
		{Name: "non_interactive", Type: field.TypeBool},
		{Name: "channel", Type: field.TypeString, Nullable: true},
		{Name: "platform", Type: field.TypeString, Nullable: true},
		{Name: "properties", Type: field.TypeJSON, Nullable: true},
		{Name: "timestamp", Type: field.TypeTime},
		{Name: "event_app", Type: field.TypeInt, Nullable: true},
		{Name: "event_campaign", Type: field.TypeInt, Nullable: true},
		{Name: "event_device", Type: field.TypeString, Nullable: true},
		{Name: "event_extra", Type: field.TypeInt, Nullable: true},
		{Name: "event_group", Type: field.TypeInt, Nullable: true},
		{Name: "event_library", Type: field.TypeInt, Nullable: true},
		{Name: "event_location", Type: field.TypeInt, Nullable: true},
		{Name: "event_network", Type: field.TypeInt, Nullable: true},
		{Name: "event_os", Type: field.TypeInt, Nullable: true},
		{Name: "event_page", Type: field.TypeInt, Nullable: true},
		{Name: "event_referrer", Type: field.TypeInt, Nullable: true},
		{Name: "event_screen", Type: field.TypeInt, Nullable: true},
		{Name: "event_session", Type: field.TypeUUID, Nullable: true},
		{Name: "event_timing", Type: field.TypeInt, Nullable: true},
		{Name: "event_viewport", Type: field.TypeInt, Nullable: true},
		{Name: "event_user", Type: field.TypeString, Nullable: true},
	}
	// EventsTable holds the schema information for the "events" table.
	EventsTable = &schema.Table{
		Name:       "events",
		Columns:    EventsColumns,
		PrimaryKey: []*schema.Column{EventsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:  "events_apps_app",
				Columns: []*schema.Column{EventsColumns[8]},

				RefColumns: []*schema.Column{AppsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:  "events_campaigns_campaign",
				Columns: []*schema.Column{EventsColumns[9]},

				RefColumns: []*schema.Column{CampaignsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:  "events_devices_device",
				Columns: []*schema.Column{EventsColumns[10]},

				RefColumns: []*schema.Column{DevicesColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:  "events_extras_extra",
				Columns: []*schema.Column{EventsColumns[11]},

				RefColumns: []*schema.Column{ExtrasColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:  "events_groups_group",
				Columns: []*schema.Column{EventsColumns[12]},

				RefColumns: []*schema.Column{GroupsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:  "events_libraries_library",
				Columns: []*schema.Column{EventsColumns[13]},

				RefColumns: []*schema.Column{LibrariesColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:  "events_locations_location",
				Columns: []*schema.Column{EventsColumns[14]},

				RefColumns: []*schema.Column{LocationsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:  "events_networks_network",
				Columns: []*schema.Column{EventsColumns[15]},

				RefColumns: []*schema.Column{NetworksColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:  "events_os_os",
				Columns: []*schema.Column{EventsColumns[16]},

				RefColumns: []*schema.Column{OsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:  "events_pages_page",
				Columns: []*schema.Column{EventsColumns[17]},

				RefColumns: []*schema.Column{PagesColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:  "events_referrers_referrer",
				Columns: []*schema.Column{EventsColumns[18]},

				RefColumns: []*schema.Column{ReferrersColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:  "events_screens_screen",
				Columns: []*schema.Column{EventsColumns[19]},

				RefColumns: []*schema.Column{ScreensColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:  "events_sessions_session",
				Columns: []*schema.Column{EventsColumns[20]},

				RefColumns: []*schema.Column{SessionsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:  "events_timings_timing",
				Columns: []*schema.Column{EventsColumns[21]},

				RefColumns: []*schema.Column{TimingsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:  "events_viewports_viewport",
				Columns: []*schema.Column{EventsColumns[22]},

				RefColumns: []*schema.Column{ViewportsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:  "events_users_user",
				Columns: []*schema.Column{EventsColumns[23]},

				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// ExtrasColumns holds the columns for the "extras" table.
	ExtrasColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "values", Type: field.TypeJSON},
	}
	// ExtrasTable holds the schema information for the "extras" table.
	ExtrasTable = &schema.Table{
		Name:        "extras",
		Columns:     ExtrasColumns,
		PrimaryKey:  []*schema.Column{ExtrasColumns[0]},
		ForeignKeys: []*schema.ForeignKey{},
	}
	// GroupsColumns holds the columns for the "groups" table.
	GroupsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name", Type: field.TypeString},
	}
	// GroupsTable holds the schema information for the "groups" table.
	GroupsTable = &schema.Table{
		Name:        "groups",
		Columns:     GroupsColumns,
		PrimaryKey:  []*schema.Column{GroupsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{},
	}
	// LibrariesColumns holds the columns for the "libraries" table.
	LibrariesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name", Type: field.TypeString},
		{Name: "version", Type: field.TypeString, Nullable: true},
	}
	// LibrariesTable holds the schema information for the "libraries" table.
	LibrariesTable = &schema.Table{
		Name:        "libraries",
		Columns:     LibrariesColumns,
		PrimaryKey:  []*schema.Column{LibrariesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{},
	}
	// LocationsColumns holds the columns for the "locations" table.
	LocationsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "street", Type: field.TypeString, Nullable: true},
		{Name: "city", Type: field.TypeString, Nullable: true},
		{Name: "state", Type: field.TypeString, Nullable: true},
		{Name: "postalcode", Type: field.TypeString, Nullable: true},
		{Name: "region", Type: field.TypeString, Nullable: true},
		{Name: "locale", Type: field.TypeString, Nullable: true},
		{Name: "country", Type: field.TypeString, Nullable: true},
		{Name: "longitude", Type: field.TypeFloat64, Nullable: true},
		{Name: "latitude", Type: field.TypeFloat64, Nullable: true},
		{Name: "timezone", Type: field.TypeString, Nullable: true},
	}
	// LocationsTable holds the schema information for the "locations" table.
	LocationsTable = &schema.Table{
		Name:        "locations",
		Columns:     LocationsColumns,
		PrimaryKey:  []*schema.Column{LocationsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{},
	}
	// NetworksColumns holds the columns for the "networks" table.
	NetworksColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "ip", Type: field.TypeString},
		{Name: "useragent", Type: field.TypeString, 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{},
	}
	// OsColumns holds the columns for the "os" table.
	OsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name", Type: field.TypeString},
		{Name: "family", Type: field.TypeString},
		{Name: "platform", Type: field.TypeString, Nullable: true},
		{Name: "version", Type: field.TypeString},
	}
	// OsTable holds the schema information for the "os" table.
	OsTable = &schema.Table{
		Name:        "os",
		Columns:     OsColumns,
		PrimaryKey:  []*schema.Column{OsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{},
	}
	// PagesColumns holds the columns for the "pages" table.
	PagesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "hostname", Type: field.TypeString},
		{Name: "path", Type: field.TypeString},
		{Name: "referrer", Type: field.TypeString, Nullable: true},
		{Name: "search", Type: field.TypeString, Nullable: true},
		{Name: "title", Type: field.TypeString, Nullable: true},
		{Name: "hash", Type: field.TypeString, Nullable: true},
	}
	// PagesTable holds the schema information for the "pages" table.
	PagesTable = &schema.Table{
		Name:        "pages",
		Columns:     PagesColumns,
		PrimaryKey:  []*schema.Column{PagesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{},
	}
	// ReferrersColumns holds the columns for the "referrers" table.
	ReferrersColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name", Type: field.TypeString},
		{Name: "type", Type: field.TypeString, Nullable: true},
		{Name: "hostname", Type: field.TypeString, Nullable: true},
		{Name: "link", Type: field.TypeString, Nullable: true},
	}
	// ReferrersTable holds the schema information for the "referrers" table.
	ReferrersTable = &schema.Table{
		Name:        "referrers",
		Columns:     ReferrersColumns,
		PrimaryKey:  []*schema.Column{ReferrersColumns[0]},
		ForeignKeys: []*schema.ForeignKey{},
	}
	// ScreensColumns holds the columns for the "screens" table.
	ScreensColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name", Type: field.TypeString},
		{Name: "category", Type: field.TypeString, Nullable: true},
	}
	// ScreensTable holds the schema information for the "screens" table.
	ScreensTable = &schema.Table{
		Name:        "screens",
		Columns:     ScreensColumns,
		PrimaryKey:  []*schema.Column{ScreensColumns[0]},
		ForeignKeys: []*schema.ForeignKey{},
	}
	// SessionsColumns holds the columns for the "sessions" table.
	SessionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "new_user", Type: field.TypeBool},
		{Name: "is_unique", Type: field.TypeBool},
		{Name: "is_bounce", Type: field.TypeBool},
		{Name: "is_finished", Type: field.TypeBool},
		{Name: "duration", Type: field.TypeInt, Nullable: true},
		{Name: "started_at", Type: field.TypeTime},
		{Name: "finished_at", Type: field.TypeTime, Nullable: true},
	}
	// SessionsTable holds the schema information for the "sessions" table.
	SessionsTable = &schema.Table{
		Name:        "sessions",
		Columns:     SessionsColumns,
		PrimaryKey:  []*schema.Column{SessionsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{},
	}
	// TimingsColumns holds the columns for the "timings" table.
	TimingsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "category", Type: field.TypeString},
		{Name: "label", Type: field.TypeString},
		{Name: "unit", Type: field.TypeString},
		{Name: "variable", Type: field.TypeString},
		{Name: "value", Type: field.TypeFloat64},
	}
	// TimingsTable holds the schema information for the "timings" table.
	TimingsTable = &schema.Table{
		Name:        "timings",
		Columns:     TimingsColumns,
		PrimaryKey:  []*schema.Column{TimingsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{},
	}
	// UsersColumns holds the columns for the "users" table.
	UsersColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString},
		{Name: "is_anonymous", Type: field.TypeBool},
		{Name: "name", Type: field.TypeString, Nullable: true},
		{Name: "title", Type: field.TypeString, Nullable: true},
		{Name: "first_name", Type: field.TypeString, Nullable: true},
		{Name: "last_name", Type: field.TypeString, Nullable: true},
		{Name: "email", Type: field.TypeString, Nullable: true},
		{Name: "username", Type: field.TypeString, Nullable: true},
		{Name: "age", Type: field.TypeInt, Nullable: true},
		{Name: "birthday", Type: field.TypeTime, Nullable: true},
		{Name: "gender", Type: field.TypeEnum, Nullable: true, Enums: []string{"M", "F", "O"}},
		{Name: "phone", Type: field.TypeString, Nullable: true},
		{Name: "website", Type: field.TypeString, Nullable: true},
		{Name: "extra", Type: field.TypeJSON, Nullable: true},
	}
	// UsersTable holds the schema information for the "users" table.
	UsersTable = &schema.Table{
		Name:        "users",
		Columns:     UsersColumns,
		PrimaryKey:  []*schema.Column{UsersColumns[0]},
		ForeignKeys: []*schema.ForeignKey{},
	}
	// ViewportsColumns holds the columns for the "viewports" table.
	ViewportsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "density", Type: field.TypeInt},
		{Name: "width", Type: field.TypeInt},
		{Name: "height", Type: field.TypeInt},
	}
	// ViewportsTable holds the schema information for the "viewports" table.
	ViewportsTable = &schema.Table{
		Name:        "viewports",
		Columns:     ViewportsColumns,
		PrimaryKey:  []*schema.Column{ViewportsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{},
	}
	// GroupUsersColumns holds the columns for the "group_users" table.
	GroupUsersColumns = []*schema.Column{
		{Name: "group_id", Type: field.TypeInt},
		{Name: "user_id", Type: field.TypeString},
	}
	// GroupUsersTable holds the schema information for the "group_users" table.
	GroupUsersTable = &schema.Table{
		Name:       "group_users",
		Columns:    GroupUsersColumns,
		PrimaryKey: []*schema.Column{GroupUsersColumns[0], GroupUsersColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:  "group_users_group_id",
				Columns: []*schema.Column{GroupUsersColumns[0]},

				RefColumns: []*schema.Column{GroupsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:  "group_users_user_id",
				Columns: []*schema.Column{GroupUsersColumns[1]},

				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// Tables holds all the tables in the schema.
	Tables = []*schema.Table{
		ActionsTable,
		AliasTable,
		AppsTable,
		BrowsersTable,
		CampaignsTable,
		ConnectivitiesTable,
		DevicesTable,
		EventsTable,
		ExtrasTable,
		GroupsTable,
		LibrariesTable,
		LocationsTable,
		NetworksTable,
		OsTable,
		PagesTable,
		ReferrersTable,
		ScreensTable,
		SessionsTable,
		TimingsTable,
		UsersTable,
		ViewportsTable,
		GroupUsersTable,
	}
)

Functions

This section is empty.

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