Last active
July 19, 2019 13:42
-
-
Save drexel-ue/39846af07229584d055b50ae2e5b18d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error: | |
*** There was an issue. Reason: there is no unique constraint matching given keys for referenced table "_video". Table: null Column: null | |
_hashtag: | |
import 'package:vw_serv/model/hashtagging.dart'; | |
import 'package:vw_serv/vw_serv.dart'; | |
class HashTag extends ManagedObject<_HashTag> implements _HashTag {} | |
class _HashTag { | |
@Column(indexed: true, omitByDefault: true, autoincrement: true) | |
int id; | |
@Column(primaryKey: true) | |
String identifier; | |
@Column() | |
DateTime createdAt; | |
ManagedSet<HashTagging> hashtaggings; | |
@Column(nullable: false) | |
String tag; | |
} | |
_video: | |
import 'package:vw_serv/model/hashtagging.dart'; | |
import 'package:vw_serv/model/like.dart'; | |
import 'package:vw_serv/model/share.dart'; | |
import 'package:vw_serv/model/user.dart'; | |
import 'package:vw_serv/vw_serv.dart'; | |
class Video extends ManagedObject<_Video> implements _Video { | |
@Serialize(output: false) | |
String userIdentifier; | |
@Serialize(output: false) | |
List<String> hashes; | |
@Serialize(output: false) | |
List<String> friends; | |
@Serialize(output: false) | |
List<String> shareTo; | |
} | |
class _Video { | |
@Column(indexed: true, omitByDefault: true, autoincrement: true) | |
int id; | |
@Column(primaryKey: true) | |
String identifier; | |
@Column() | |
DateTime createdAt; | |
@Column() | |
String createdBy; | |
@Relate(#videos) | |
User creator; | |
ManagedSet<HashTagging> hashtaggings; | |
ManagedSet<Like> likes; | |
ManagedSet<Share> shares; | |
@Column() | |
String title; | |
@Column(nullable: true) | |
String content; | |
@Column(defaultValue: "true") | |
bool public; | |
@Column(nullable: true) | |
double latitude; | |
@Column(nullable: true) | |
double longitude; | |
@Column() | |
double aspectRatio; | |
@Column() | |
String appliedFilter; | |
@Column() | |
String type; | |
@Column(nullable: true) | |
int startTime; | |
@Column() | |
String downloadUrl; | |
@Column() | |
String thumbUrl; | |
} | |
_hashTag migration: | |
import 'dart:async'; | |
import 'package:aqueduct/aqueduct.dart'; | |
class Migration9 extends Migration { | |
@override | |
Future upgrade() async { | |
database.createTable(SchemaTable("_HashTag", [ | |
SchemaColumn("id", ManagedPropertyType.bigInteger, | |
isPrimaryKey: false, | |
autoincrement: true, | |
isIndexed: true, | |
isNullable: false, | |
isUnique: false), | |
SchemaColumn("identifier", ManagedPropertyType.string, | |
isPrimaryKey: true, | |
autoincrement: false, | |
isIndexed: true, | |
isNullable: true, | |
isUnique: false), | |
SchemaColumn("tag", ManagedPropertyType.string, | |
isPrimaryKey: false, | |
autoincrement: false, | |
isIndexed: false, | |
isNullable: false, | |
isUnique: false) | |
])); | |
database.addColumn( | |
"_HashTag", | |
SchemaColumn.relationship("video", ManagedPropertyType.bigInteger, | |
relatedTableName: "_Video", | |
relatedColumnName: "id", | |
rule: DeleteRule.nullify, | |
isNullable: true, | |
isUnique: false)); | |
} | |
@override | |
Future downgrade() async {} | |
@override | |
Future seed() async {} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment