1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
|
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
// Code generated by ent, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// FriendshipsColumns holds the columns for the "friendships" table.
FriendshipsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "weight", Type: field.TypeInt, Default: 1},
{Name: "created_at", Type: field.TypeTime},
{Name: "user_id", Type: field.TypeInt},
{Name: "friend_id", Type: field.TypeInt},
}
// FriendshipsTable holds the schema information for the "friendships" table.
FriendshipsTable = &schema.Table{
Name: "friendships",
Columns: FriendshipsColumns,
PrimaryKey: []*schema.Column{FriendshipsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "friendships_users_user",
Columns: []*schema.Column{FriendshipsColumns[3]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "friendships_users_friend",
Columns: []*schema.Column{FriendshipsColumns[4]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "friendship_user_id_friend_id",
Unique: true,
Columns: []*schema.Column{FriendshipsColumns[3], FriendshipsColumns[4]},
},
{
Name: "friendship_created_at",
Unique: false,
Columns: []*schema.Column{FriendshipsColumns[2]},
},
},
}
// GroupsColumns holds the columns for the "groups" table.
GroupsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "name", Type: field.TypeString, Default: "Unknown"},
}
// GroupsTable holds the schema information for the "groups" table.
GroupsTable = &schema.Table{
Name: "groups",
Columns: GroupsColumns,
PrimaryKey: []*schema.Column{GroupsColumns[0]},
}
// RelationshipsColumns holds the columns for the "relationships" table.
RelationshipsColumns = []*schema.Column{
{Name: "weight", Type: field.TypeInt, Default: 1},
{Name: "user_id", Type: field.TypeInt},
{Name: "relative_id", Type: field.TypeInt},
{Name: "info_id", Type: field.TypeInt, Nullable: true},
}
// RelationshipsTable holds the schema information for the "relationships" table.
RelationshipsTable = &schema.Table{
Name: "relationships",
Columns: RelationshipsColumns,
PrimaryKey: []*schema.Column{RelationshipsColumns[1], RelationshipsColumns[2]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "relationships_users_user",
Columns: []*schema.Column{RelationshipsColumns[1]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "relationships_users_relative",
Columns: []*schema.Column{RelationshipsColumns[2]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "relationships_relationship_infos_info",
Columns: []*schema.Column{RelationshipsColumns[3]},
RefColumns: []*schema.Column{RelationshipInfosColumns[0]},
OnDelete: schema.SetNull,
},
},
Indexes: []*schema.Index{
{
Name: "relationship_weight",
Unique: false,
Columns: []*schema.Column{RelationshipsColumns[0]},
},
{
Name: "relationship_info_id",
Unique: true,
Columns: []*schema.Column{RelationshipsColumns[3]},
},
},
}
// RelationshipInfosColumns holds the columns for the "relationship_infos" table.
RelationshipInfosColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "text", Type: field.TypeString},
}
// RelationshipInfosTable holds the schema information for the "relationship_infos" table.
RelationshipInfosTable = &schema.Table{
Name: "relationship_infos",
Columns: RelationshipInfosColumns,
PrimaryKey: []*schema.Column{RelationshipInfosColumns[0]},
}
// RolesColumns holds the columns for the "roles" table.
RolesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "name", Type: field.TypeString, Unique: true},
{Name: "created_at", Type: field.TypeTime},
}
// RolesTable holds the schema information for the "roles" table.
RolesTable = &schema.Table{
Name: "roles",
Columns: RolesColumns,
PrimaryKey: []*schema.Column{RolesColumns[0]},
}
// RoleUsersColumns holds the columns for the "role_users" table.
RoleUsersColumns = []*schema.Column{
{Name: "created_at", Type: field.TypeTime},
{Name: "role_id", Type: field.TypeInt},
{Name: "user_id", Type: field.TypeInt},
}
// RoleUsersTable holds the schema information for the "role_users" table.
RoleUsersTable = &schema.Table{
Name: "role_users",
Columns: RoleUsersColumns,
PrimaryKey: []*schema.Column{RoleUsersColumns[2], RoleUsersColumns[1]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "role_users_roles_role",
Columns: []*schema.Column{RoleUsersColumns[1]},
RefColumns: []*schema.Column{RolesColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "role_users_users_user",
Columns: []*schema.Column{RoleUsersColumns[2]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
}
// TagsColumns holds the columns for the "tags" table.
TagsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "value", Type: field.TypeString},
}
// TagsTable holds the schema information for the "tags" table.
TagsTable = &schema.Table{
Name: "tags",
Columns: TagsColumns,
PrimaryKey: []*schema.Column{TagsColumns[0]},
}
// TweetsColumns holds the columns for the "tweets" table.
TweetsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "text", Type: field.TypeString, Size: 2147483647},
}
// TweetsTable holds the schema information for the "tweets" table.
TweetsTable = &schema.Table{
Name: "tweets",
Columns: TweetsColumns,
PrimaryKey: []*schema.Column{TweetsColumns[0]},
}
// TweetLikesColumns holds the columns for the "tweet_likes" table.
TweetLikesColumns = []*schema.Column{
{Name: "liked_at", Type: field.TypeTime},
{Name: "tweet_id", Type: field.TypeInt},
{Name: "user_id", Type: field.TypeInt},
}
// TweetLikesTable holds the schema information for the "tweet_likes" table.
TweetLikesTable = &schema.Table{
Name: "tweet_likes",
Columns: TweetLikesColumns,
PrimaryKey: []*schema.Column{TweetLikesColumns[2], TweetLikesColumns[1]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "tweet_likes_tweets_tweet",
Columns: []*schema.Column{TweetLikesColumns[1]},
RefColumns: []*schema.Column{TweetsColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "tweet_likes_users_user",
Columns: []*schema.Column{TweetLikesColumns[2]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
}
// TweetTagsColumns holds the columns for the "tweet_tags" table.
TweetTagsColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID},
{Name: "added_at", Type: field.TypeTime},
{Name: "tag_id", Type: field.TypeInt},
{Name: "tweet_id", Type: field.TypeInt},
}
// TweetTagsTable holds the schema information for the "tweet_tags" table.
TweetTagsTable = &schema.Table{
Name: "tweet_tags",
Columns: TweetTagsColumns,
PrimaryKey: []*schema.Column{TweetTagsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "tweet_tags_tags_tag",
Columns: []*schema.Column{TweetTagsColumns[2]},
RefColumns: []*schema.Column{TagsColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "tweet_tags_tweets_tweet",
Columns: []*schema.Column{TweetTagsColumns[3]},
RefColumns: []*schema.Column{TweetsColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "tweettag_tag_id_tweet_id",
Unique: true,
Columns: []*schema.Column{TweetTagsColumns[2], TweetTagsColumns[3]},
},
},
}
// UsersColumns holds the columns for the "users" table.
UsersColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "name", Type: field.TypeString, Default: "Unknown"},
}
// UsersTable holds the schema information for the "users" table.
UsersTable = &schema.Table{
Name: "users",
Columns: UsersColumns,
PrimaryKey: []*schema.Column{UsersColumns[0]},
}
// UserGroupsColumns holds the columns for the "user_groups" table.
UserGroupsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "joined_at", Type: field.TypeTime},
{Name: "user_id", Type: field.TypeInt},
{Name: "group_id", Type: field.TypeInt},
}
// UserGroupsTable holds the schema information for the "user_groups" table.
UserGroupsTable = &schema.Table{
Name: "user_groups",
Columns: UserGroupsColumns,
PrimaryKey: []*schema.Column{UserGroupsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "user_groups_users_user",
Columns: []*schema.Column{UserGroupsColumns[2]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "user_groups_groups_group",
Columns: []*schema.Column{UserGroupsColumns[3]},
RefColumns: []*schema.Column{GroupsColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "usergroup_user_id_group_id",
Unique: true,
Columns: []*schema.Column{UserGroupsColumns[2], UserGroupsColumns[3]},
},
},
}
// UserTweetsColumns holds the columns for the "user_tweets" table.
UserTweetsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "user_id", Type: field.TypeInt},
{Name: "tweet_id", Type: field.TypeInt},
}
// UserTweetsTable holds the schema information for the "user_tweets" table.
UserTweetsTable = &schema.Table{
Name: "user_tweets",
Columns: UserTweetsColumns,
PrimaryKey: []*schema.Column{UserTweetsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "user_tweets_users_user",
Columns: []*schema.Column{UserTweetsColumns[2]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "user_tweets_tweets_tweet",
Columns: []*schema.Column{UserTweetsColumns[3]},
RefColumns: []*schema.Column{TweetsColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "usertweet_user_id_tweet_id",
Unique: true,
Columns: []*schema.Column{UserTweetsColumns[2], UserTweetsColumns[3]},
},
{
Name: "usertweet_tweet_id",
Unique: true,
Columns: []*schema.Column{UserTweetsColumns[3]},
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
FriendshipsTable,
GroupsTable,
RelationshipsTable,
RelationshipInfosTable,
RolesTable,
RoleUsersTable,
TagsTable,
TweetsTable,
TweetLikesTable,
TweetTagsTable,
UsersTable,
UserGroupsTable,
UserTweetsTable,
}
)
func init() {
FriendshipsTable.ForeignKeys[0].RefTable = UsersTable
FriendshipsTable.ForeignKeys[1].RefTable = UsersTable
RelationshipsTable.ForeignKeys[0].RefTable = UsersTable
RelationshipsTable.ForeignKeys[1].RefTable = UsersTable
RelationshipsTable.ForeignKeys[2].RefTable = RelationshipInfosTable
RoleUsersTable.ForeignKeys[0].RefTable = RolesTable
RoleUsersTable.ForeignKeys[1].RefTable = UsersTable
TweetLikesTable.ForeignKeys[0].RefTable = TweetsTable
TweetLikesTable.ForeignKeys[1].RefTable = UsersTable
TweetTagsTable.ForeignKeys[0].RefTable = TagsTable
TweetTagsTable.ForeignKeys[1].RefTable = TweetsTable
UserGroupsTable.ForeignKeys[0].RefTable = UsersTable
UserGroupsTable.ForeignKeys[1].RefTable = GroupsTable
UserTweetsTable.ForeignKeys[0].RefTable = UsersTable
UserTweetsTable.ForeignKeys[1].RefTable = TweetsTable
}
|