modified db for local images, added file list saving functionality
This commit is contained in:
@ -35,7 +35,7 @@ class AppDatabase extends _$AppDatabase {
|
||||
AppDatabase() : super(_openConnection());
|
||||
|
||||
@override
|
||||
int get schemaVersion => 7;
|
||||
int get schemaVersion => 9;
|
||||
|
||||
@override
|
||||
MigrationStrategy get migration {
|
||||
@ -141,13 +141,13 @@ class ObjectMediaItems extends Table {
|
||||
dateTime().withDefault(Variable(DateTime.now()))();
|
||||
}
|
||||
|
||||
enum MediaType { youtube, image, location }
|
||||
enum MediaType { youtube, image, location, localImage }
|
||||
|
||||
class MediaItems extends Table {
|
||||
IntColumn get id => integer().autoIncrement()();
|
||||
TextColumn get title => text().withLength(min: 3, max: 32)();
|
||||
TextColumn get description => text().named('body')();
|
||||
TextColumn get reference => text().withLength(min: 3, max: 256)();
|
||||
TextColumn get reference => text()();
|
||||
TextColumn get type => textEnum<MediaType>()();
|
||||
DateTimeColumn get createdAt =>
|
||||
dateTime().withDefault(Variable(DateTime.now()))();
|
||||
|
@ -1764,10 +1764,7 @@ class $MediaItemsTable extends MediaItems
|
||||
@override
|
||||
late final GeneratedColumn<String> reference = GeneratedColumn<String>(
|
||||
'reference', aliasedName, false,
|
||||
additionalChecks:
|
||||
GeneratedColumn.checkTextLength(minTextLength: 3, maxTextLength: 256),
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: true);
|
||||
type: DriftSqlType.string, requiredDuringInsert: true);
|
||||
static const VerificationMeta _typeMeta = const VerificationMeta('type');
|
||||
@override
|
||||
late final GeneratedColumnWithTypeConverter<MediaType, String> type =
|
||||
|
@ -1088,6 +1088,273 @@ final class Schema7 extends i0.VersionedSchema {
|
||||
alias: null);
|
||||
}
|
||||
|
||||
final class Schema8 extends i0.VersionedSchema {
|
||||
Schema8({required super.database}) : super(version: 8);
|
||||
@override
|
||||
late final List<i1.DatabaseSchemaEntity> entities = [
|
||||
sessions,
|
||||
activities,
|
||||
sessionActivities,
|
||||
actions,
|
||||
activityActions,
|
||||
mediaItems,
|
||||
objectMediaItems,
|
||||
];
|
||||
late final Shape11 sessions = Shape11(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'sessions',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_1,
|
||||
_column_2,
|
||||
_column_3,
|
||||
_column_20,
|
||||
_column_4,
|
||||
_column_5,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape1 activities = Shape1(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'activities',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_1,
|
||||
_column_6,
|
||||
_column_2,
|
||||
_column_7,
|
||||
_column_5,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape9 sessionActivities = Shape9(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'session_activities',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_21,
|
||||
_column_22,
|
||||
_column_19,
|
||||
_column_10,
|
||||
_column_11,
|
||||
_column_5,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape3 actions = Shape3(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'actions',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_1,
|
||||
_column_2,
|
||||
_column_12,
|
||||
_column_5,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape10 activityActions = Shape10(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'activity_actions',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_22,
|
||||
_column_23,
|
||||
_column_19,
|
||||
_column_5,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape5 mediaItems = Shape5(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'media_items',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_1,
|
||||
_column_2,
|
||||
_column_14,
|
||||
_column_6,
|
||||
_column_5,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape6 objectMediaItems = Shape6(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'object_media_items',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_15,
|
||||
_column_16,
|
||||
_column_24,
|
||||
_column_5,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
}
|
||||
|
||||
final class Schema9 extends i0.VersionedSchema {
|
||||
Schema9({required super.database}) : super(version: 9);
|
||||
@override
|
||||
late final List<i1.DatabaseSchemaEntity> entities = [
|
||||
sessions,
|
||||
activities,
|
||||
sessionActivities,
|
||||
actions,
|
||||
activityActions,
|
||||
mediaItems,
|
||||
objectMediaItems,
|
||||
];
|
||||
late final Shape11 sessions = Shape11(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'sessions',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_1,
|
||||
_column_2,
|
||||
_column_3,
|
||||
_column_20,
|
||||
_column_4,
|
||||
_column_5,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape1 activities = Shape1(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'activities',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_1,
|
||||
_column_6,
|
||||
_column_2,
|
||||
_column_7,
|
||||
_column_5,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape9 sessionActivities = Shape9(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'session_activities',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_21,
|
||||
_column_22,
|
||||
_column_19,
|
||||
_column_10,
|
||||
_column_11,
|
||||
_column_5,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape3 actions = Shape3(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'actions',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_1,
|
||||
_column_2,
|
||||
_column_12,
|
||||
_column_5,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape10 activityActions = Shape10(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'activity_actions',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_22,
|
||||
_column_23,
|
||||
_column_19,
|
||||
_column_5,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape5 mediaItems = Shape5(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'media_items',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_1,
|
||||
_column_2,
|
||||
_column_25,
|
||||
_column_6,
|
||||
_column_5,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape6 objectMediaItems = Shape6(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'object_media_items',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_15,
|
||||
_column_16,
|
||||
_column_24,
|
||||
_column_5,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
}
|
||||
|
||||
i1.GeneratedColumn<String> _column_25(String aliasedName) =>
|
||||
i1.GeneratedColumn<String>('reference', aliasedName, false,
|
||||
type: i1.DriftSqlType.string);
|
||||
i0.MigrationStepWithVersion migrationSteps({
|
||||
required Future<void> Function(i1.Migrator m, Schema2 schema) from1To2,
|
||||
required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,
|
||||
@ -1095,6 +1362,8 @@ i0.MigrationStepWithVersion migrationSteps({
|
||||
required Future<void> Function(i1.Migrator m, Schema5 schema) from4To5,
|
||||
required Future<void> Function(i1.Migrator m, Schema6 schema) from5To6,
|
||||
required Future<void> Function(i1.Migrator m, Schema7 schema) from6To7,
|
||||
required Future<void> Function(i1.Migrator m, Schema8 schema) from7To8,
|
||||
required Future<void> Function(i1.Migrator m, Schema9 schema) from8To9,
|
||||
}) {
|
||||
return (currentVersion, database) async {
|
||||
switch (currentVersion) {
|
||||
@ -1128,6 +1397,16 @@ i0.MigrationStepWithVersion migrationSteps({
|
||||
final migrator = i1.Migrator(database, schema);
|
||||
await from6To7(migrator, schema);
|
||||
return 7;
|
||||
case 7:
|
||||
final schema = Schema8(database: database);
|
||||
final migrator = i1.Migrator(database, schema);
|
||||
await from7To8(migrator, schema);
|
||||
return 8;
|
||||
case 8:
|
||||
final schema = Schema9(database: database);
|
||||
final migrator = i1.Migrator(database, schema);
|
||||
await from8To9(migrator, schema);
|
||||
return 9;
|
||||
default:
|
||||
throw ArgumentError.value('Unknown migration from $currentVersion');
|
||||
}
|
||||
@ -1141,6 +1420,8 @@ i1.OnUpgrade stepByStep({
|
||||
required Future<void> Function(i1.Migrator m, Schema5 schema) from4To5,
|
||||
required Future<void> Function(i1.Migrator m, Schema6 schema) from5To6,
|
||||
required Future<void> Function(i1.Migrator m, Schema7 schema) from6To7,
|
||||
required Future<void> Function(i1.Migrator m, Schema8 schema) from7To8,
|
||||
required Future<void> Function(i1.Migrator m, Schema9 schema) from8To9,
|
||||
}) =>
|
||||
i0.VersionedSchema.stepByStepHelper(
|
||||
step: migrationSteps(
|
||||
@ -1150,4 +1431,6 @@ i1.OnUpgrade stepByStep({
|
||||
from4To5: from4To5,
|
||||
from5To6: from5To6,
|
||||
from6To7: from6To7,
|
||||
from7To8: from7To8,
|
||||
from8To9: from8To9,
|
||||
));
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -7,24 +7,29 @@ Future<void> seedDb(AppDatabase database) async {
|
||||
// seed data setup
|
||||
final List<List> sessionValues = [
|
||||
[
|
||||
'Projecting @ Climbers Rock',
|
||||
'Projecting',
|
||||
'Beta pully beta beta pinch one arm crimpy. Futuristic pinch, dyno dynamic drop knee climb. Climbing ondra slopey onsight beta ondra power endurance.'
|
||||
'Climbers Rock Inc.'
|
||||
],
|
||||
[
|
||||
'Moonboard @ Boardroom',
|
||||
'Moonboard',
|
||||
'Beta pully beta beta pinch one arm crimpy. Futuristic pinch, dyno dynamic drop knee climb. Climbing ondra slopey onsight beta ondra power endurance.'
|
||||
'Beta Bloc'
|
||||
],
|
||||
[
|
||||
'Off-Wall Training',
|
||||
'Beta pully beta beta pinch one arm crimpy. Futuristic pinch, dyno dynamic drop knee climb. Climbing ondra slopey onsight beta ondra power endurance.'
|
||||
'Climbers Rcok Inc.'
|
||||
],
|
||||
[
|
||||
'Climbing Outdoors',
|
||||
'Beta pully beta beta pinch one arm crimpy. Futuristic pinch, dyno dynamic drop knee climb. Climbing ondra slopey onsight beta ondra power endurance.'
|
||||
'Gravity Hamilton'
|
||||
],
|
||||
[
|
||||
'Volume Session @ Gravity',
|
||||
'Volume Session',
|
||||
'Beta pully beta beta pinch one arm crimpy. Futuristic pinch, dyno dynamic drop knee climb. Climbing ondra slopey onsight beta ondra power endurance.'
|
||||
'Up the Bloc'
|
||||
],
|
||||
];
|
||||
|
||||
@ -162,6 +167,23 @@ Future<void> seedDb(AppDatabase database) async {
|
||||
objectType: ObjectType.sessions));
|
||||
});
|
||||
}
|
||||
|
||||
await database
|
||||
.into(database.mediaItems)
|
||||
.insert(MediaItemsCompanion.insert(
|
||||
title: 'Locations details',
|
||||
description:
|
||||
'5155 Harvester Rd #1, Burlington, ON L7L 6V2, Canada',
|
||||
reference:
|
||||
'https://lh3.googleusercontent.com/places/ANXAkqHz0IeMrJnqjBwQJvYVHv9qSp0huWPCBcdeMZds66wpLofxGAIk3KrYFD2ShEZzqm1A-GO7BfmO3OtRdjSlnO6DAHgyDv_C_7w=s4800-w800',
|
||||
type: MediaType.location))
|
||||
.then((mediaId) async {
|
||||
await database.into(database.objectMediaItems).insert(
|
||||
ObjectMediaItemsCompanion.insert(
|
||||
objectId: sessionId,
|
||||
mediaId: mediaId,
|
||||
objectType: ObjectType.activities));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user