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 ( // SongsColumns holds the columns for the "songs" table. SongsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "path", Type: field.TypeString}, {Name: "hash", Type: field.TypeString}, {Name: "title", Type: field.TypeString, Nullable: true}, {Name: "title_sort", Type: field.TypeString, Nullable: true}, {Name: "artists", Type: field.TypeJSON, Nullable: true}, {Name: "first_artist", Type: field.TypeString, Nullable: true}, {Name: "first_artist_sort", Type: field.TypeString, Nullable: true}, {Name: "first_album_artist", Type: field.TypeString, Nullable: true}, {Name: "first_album_artist_sort", Type: field.TypeString, Nullable: true}, {Name: "album_artist", Type: field.TypeString, Nullable: true}, {Name: "album", Type: field.TypeString, Nullable: true}, {Name: "publisher", Type: field.TypeString, Nullable: true}, {Name: "first_composer", Type: field.TypeString, Nullable: true}, {Name: "composers", Type: field.TypeString, Nullable: true}, {Name: "conductor", Type: field.TypeString, Nullable: true}, {Name: "genre", Type: field.TypeString, Nullable: true}, {Name: "grouping", Type: field.TypeString, Nullable: true}, {Name: "year", Type: field.TypeUint32, Nullable: true}, {Name: "track_number", Type: field.TypeUint32, Nullable: true}, {Name: "of_track_number", Type: field.TypeUint32, Nullable: true}, {Name: "disk_number", Type: field.TypeUint32, Nullable: true}, {Name: "of_disk_number", Type: field.TypeUint32, Nullable: true}, {Name: "duration", Type: field.TypeUint32, Nullable: true}, {Name: "play_count", Type: field.TypeUint32}, {Name: "skipped_count", Type: field.TypeUint32}, {Name: "comment", Type: field.TypeString, Nullable: true}, {Name: "beats_per_minute", Type: field.TypeUint32, Nullable: true}, {Name: "copyright", Type: field.TypeString, Nullable: true}, {Name: "date_tagged", Type: field.TypeTime, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "first_composer_sort", Type: field.TypeString, Nullable: true}, {Name: "artists_sort", Type: field.TypeString, Nullable: true}, {Name: "lyrics", Type: field.TypeString, Nullable: true}, {Name: "initial_key", Type: field.TypeString, Nullable: true}, {Name: "isrc", Type: field.TypeString, Nullable: true}, {Name: "subtitle", Type: field.TypeString, Nullable: true}, {Name: "music_brainz_artist_id", Type: field.TypeString, Nullable: true}, {Name: "music_brainz_disc_id", Type: field.TypeString, Nullable: true}, {Name: "music_brainz_release_artist_id", Type: field.TypeString, Nullable: true}, {Name: "music_brainz_release_country", Type: field.TypeString, Nullable: true}, {Name: "music_brainz_release_group_id", Type: field.TypeString, Nullable: true}, {Name: "music_brainz_release_id", Type: field.TypeString, Nullable: true}, {Name: "music_brainz_release_status", Type: field.TypeString, Nullable: true}, {Name: "music_brainz_release_type", Type: field.TypeString, Nullable: true}, {Name: "music_brainz_track_id", Type: field.TypeString, Nullable: true}, {Name: "music_ip_id", Type: field.TypeString, Nullable: true}, {Name: "remixed_by", Type: field.TypeString, Nullable: true}, {Name: "replay_gain_album_gain", Type: field.TypeFloat64, Nullable: true}, {Name: "replay_gain_album_peak", Type: field.TypeFloat64, Nullable: true}, {Name: "replay_gain_track_gain", Type: field.TypeFloat64, Nullable: true}, {Name: "replay_gain_track_peak", Type: field.TypeFloat64, Nullable: true}, {Name: "mime_type", Type: field.TypeString, Nullable: true}, {Name: "created_date", Type: field.TypeTime, Nullable: true}, {Name: "modified_date", Type: field.TypeTime, Nullable: true}, } // SongsTable holds the schema information for the "songs" table. SongsTable = &schema.Table{ Name: "songs", Columns: SongsColumns, PrimaryKey: []*schema.Column{SongsColumns[0]}, ForeignKeys: []*schema.ForeignKey{}, } // TagsColumns holds the columns for the "tags" table. TagsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "name", Type: field.TypeString, Unique: true}, } // TagsTable holds the schema information for the "tags" table. TagsTable = &schema.Table{ Name: "tags", Columns: TagsColumns, PrimaryKey: []*schema.Column{TagsColumns[0]}, ForeignKeys: []*schema.ForeignKey{}, } // SongTagsColumns holds the columns for the "song_tags" table. SongTagsColumns = []*schema.Column{ {Name: "song_id", Type: field.TypeInt}, {Name: "tag_id", Type: field.TypeInt}, } // SongTagsTable holds the schema information for the "song_tags" table. SongTagsTable = &schema.Table{ Name: "song_tags", Columns: SongTagsColumns, PrimaryKey: []*schema.Column{SongTagsColumns[0], SongTagsColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "song_tags_song_id", Columns: []*schema.Column{SongTagsColumns[0]}, RefColumns: []*schema.Column{SongsColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "song_tags_tag_id", Columns: []*schema.Column{SongTagsColumns[1]}, RefColumns: []*schema.Column{TagsColumns[0]}, OnDelete: schema.Cascade, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ SongsTable, TagsTable, SongTagsTable, } )
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.
Click to show internal directories.
Click to hide internal directories.