From 6f75132073d6c6ed8df1e7f856175b143a50cebf Mon Sep 17 00:00:00 2001 From: tk Date: Sat, 16 Aug 2025 14:28:40 +0200 Subject: [PATCH] migrate db --- .../lib/src/protocol/client.dart | 49 +- .../lib/src/protocol/protocol.dart | 12 +- .../flutter/generated_plugin_registrant.cc | 4 + .../linux/flutter/generated_plugins.cmake | 1 + .../Flutter/GeneratedPluginRegistrant.swift | 10 + .../flutter/generated_plugin_registrant.cc | 3 + .../windows/flutter/generated_plugins.cmake | 1 + .../lib/src/generated/endpoints.dart | 66 +- .../lib/src/generated/protocol.dart | 4 + .../lib/src/generated/protocol.yaml | 4 + .../lib/src/quotes/quotes_endpoint.dart | 21 +- .../20250816122625449/definition.json | 1800 +++++++++++++++++ .../20250816122625449/definition.sql | 394 ++++ .../20250816122625449/definition_project.json | 107 + .../20250816122625449/migration.json | 676 +++++++ .../20250816122625449/migration.sql | 158 ++ .../migrations/migration_registry.txt | 1 + .../test_tools/serverpod_test_tools.dart | 105 + 18 files changed, 3402 insertions(+), 14 deletions(-) create mode 100644 wien_talks/wien_talks_server/migrations/20250816122625449/definition.json create mode 100644 wien_talks/wien_talks_server/migrations/20250816122625449/definition.sql create mode 100644 wien_talks/wien_talks_server/migrations/20250816122625449/definition_project.json create mode 100644 wien_talks/wien_talks_server/migrations/20250816122625449/migration.json create mode 100644 wien_talks/wien_talks_server/migrations/20250816122625449/migration.sql diff --git a/wien_talks/wien_talks_client/lib/src/protocol/client.dart b/wien_talks/wien_talks_client/lib/src/protocol/client.dart index 99e1b50..3440443 100644 --- a/wien_talks/wien_talks_client/lib/src/protocol/client.dart +++ b/wien_talks/wien_talks_client/lib/src/protocol/client.dart @@ -12,8 +12,10 @@ import 'package:serverpod_client/serverpod_client.dart' as _i1; import 'dart:async' as _i2; import 'package:wien_talks_client/src/protocol/greeting.dart' as _i3; -import 'package:serverpod_auth_client/serverpod_auth_client.dart' as _i4; -import 'protocol.dart' as _i5; +import 'package:wien_talks_client/src/protocol/quotes/quote.dart' as _i4; +import 'package:wien_talks_client/src/protocol/quotes/create_quote.dart' as _i5; +import 'package:serverpod_auth_client/serverpod_auth_client.dart' as _i6; +import 'protocol.dart' as _i7; /// This is an example endpoint that returns a greeting message through /// its [hello] method. @@ -33,12 +35,41 @@ class EndpointGreeting extends _i1.EndpointRef { ); } +/// {@category Endpoint} +class EndpointQuote extends _i1.EndpointRef { + EndpointQuote(_i1.EndpointCaller caller) : super(caller); + + @override + String get name => 'quote'; + + _i2.Future<_i4.Quote> createQuote(_i5.CreateQuoteRequest req) => + caller.callServerEndpoint<_i4.Quote>( + 'quote', + 'createQuote', + {'req': req}, + ); + + _i2.Future<_i4.Quote> getQuoteById(int id) => + caller.callServerEndpoint<_i4.Quote>( + 'quote', + 'getQuoteById', + {'id': id}, + ); + + _i2.Future> getAllQuotes() => + caller.callServerEndpoint>( + 'quote', + 'getAllQuotes', + {}, + ); +} + class Modules { Modules(Client client) { - auth = _i4.Caller(client); + auth = _i6.Caller(client); } - late final _i4.Caller auth; + late final _i6.Caller auth; } class Client extends _i1.ServerpodClientShared { @@ -57,7 +88,7 @@ class Client extends _i1.ServerpodClientShared { bool? disconnectStreamsOnLostInternetConnection, }) : super( host, - _i5.Protocol(), + _i7.Protocol(), securityContext: securityContext, authenticationKeyManager: authenticationKeyManager, streamingConnectionTimeout: streamingConnectionTimeout, @@ -68,15 +99,21 @@ class Client extends _i1.ServerpodClientShared { disconnectStreamsOnLostInternetConnection, ) { greeting = EndpointGreeting(this); + quote = EndpointQuote(this); modules = Modules(this); } late final EndpointGreeting greeting; + late final EndpointQuote quote; + late final Modules modules; @override - Map get endpointRefLookup => {'greeting': greeting}; + Map get endpointRefLookup => { + 'greeting': greeting, + 'quote': quote, + }; @override Map get moduleLookup => diff --git a/wien_talks/wien_talks_client/lib/src/protocol/protocol.dart b/wien_talks/wien_talks_client/lib/src/protocol/protocol.dart index 88a112d..f03d13d 100644 --- a/wien_talks/wien_talks_client/lib/src/protocol/protocol.dart +++ b/wien_talks/wien_talks_client/lib/src/protocol/protocol.dart @@ -13,7 +13,8 @@ import 'package:serverpod_client/serverpod_client.dart' as _i1; import 'greeting.dart' as _i2; import 'quotes/create_quote.dart' as _i3; import 'quotes/quote.dart' as _i4; -import 'package:serverpod_auth_client/serverpod_auth_client.dart' as _i5; +import 'package:wien_talks_client/src/protocol/quotes/quote.dart' as _i5; +import 'package:serverpod_auth_client/serverpod_auth_client.dart' as _i6; export 'greeting.dart'; export 'quotes/create_quote.dart'; export 'quotes/quote.dart'; @@ -60,8 +61,11 @@ class Protocol extends _i1.SerializationManager { ? (data as List).map((e) => deserialize(e)).toList() : null) as T; } + if (t == List<_i5.Quote>) { + return (data as List).map((e) => deserialize<_i5.Quote>(e)).toList() as T; + } try { - return _i5.Protocol().deserialize(data, t); + return _i6.Protocol().deserialize(data, t); } on _i1.DeserializationTypeNotFoundException catch (_) {} return super.deserialize(data, t); } @@ -79,7 +83,7 @@ class Protocol extends _i1.SerializationManager { if (data is _i4.Quote) { return 'Quote'; } - className = _i5.Protocol().getClassNameForObject(data); + className = _i6.Protocol().getClassNameForObject(data); if (className != null) { return 'serverpod_auth.$className'; } @@ -103,7 +107,7 @@ class Protocol extends _i1.SerializationManager { } if (dataClassName.startsWith('serverpod_auth.')) { data['className'] = dataClassName.substring(15); - return _i5.Protocol().deserializeByClassName(data); + return _i6.Protocol().deserializeByClassName(data); } return super.deserializeByClassName(data); } diff --git a/wien_talks/wien_talks_flutter/linux/flutter/generated_plugin_registrant.cc b/wien_talks/wien_talks_flutter/linux/flutter/generated_plugin_registrant.cc index e71a16d..64a0ece 100644 --- a/wien_talks/wien_talks_flutter/linux/flutter/generated_plugin_registrant.cc +++ b/wien_talks/wien_talks_flutter/linux/flutter/generated_plugin_registrant.cc @@ -6,6 +6,10 @@ #include "generated_plugin_registrant.h" +#include void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); + file_selector_plugin_register_with_registrar(file_selector_linux_registrar); } diff --git a/wien_talks/wien_talks_flutter/linux/flutter/generated_plugins.cmake b/wien_talks/wien_talks_flutter/linux/flutter/generated_plugins.cmake index 2e1de87..2db3c22 100644 --- a/wien_talks/wien_talks_flutter/linux/flutter/generated_plugins.cmake +++ b/wien_talks/wien_talks_flutter/linux/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + file_selector_linux ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/wien_talks/wien_talks_flutter/macos/Flutter/GeneratedPluginRegistrant.swift b/wien_talks/wien_talks_flutter/macos/Flutter/GeneratedPluginRegistrant.swift index 67b21c7..407ec0f 100644 --- a/wien_talks/wien_talks_flutter/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/wien_talks/wien_talks_flutter/macos/Flutter/GeneratedPluginRegistrant.swift @@ -6,9 +6,19 @@ import FlutterMacOS import Foundation import connectivity_plus +import file_picker +import file_selector_macos import location +import path_provider_foundation +import shared_preferences_foundation +import sqflite_darwin func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin")) + FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin")) + FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin")) + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) + SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) } diff --git a/wien_talks/wien_talks_flutter/windows/flutter/generated_plugin_registrant.cc b/wien_talks/wien_talks_flutter/windows/flutter/generated_plugin_registrant.cc index 8777c93..e6c6668 100644 --- a/wien_talks/wien_talks_flutter/windows/flutter/generated_plugin_registrant.cc +++ b/wien_talks/wien_talks_flutter/windows/flutter/generated_plugin_registrant.cc @@ -7,8 +7,11 @@ #include "generated_plugin_registrant.h" #include +#include void RegisterPlugins(flutter::PluginRegistry* registry) { ConnectivityPlusWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin")); + FileSelectorWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FileSelectorWindows")); } diff --git a/wien_talks/wien_talks_flutter/windows/flutter/generated_plugins.cmake b/wien_talks/wien_talks_flutter/windows/flutter/generated_plugins.cmake index cc1361d..d62d824 100644 --- a/wien_talks/wien_talks_flutter/windows/flutter/generated_plugins.cmake +++ b/wien_talks/wien_talks_flutter/windows/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST connectivity_plus + file_selector_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/wien_talks/wien_talks_server/lib/src/generated/endpoints.dart b/wien_talks/wien_talks_server/lib/src/generated/endpoints.dart index fba3ffe..13b7730 100644 --- a/wien_talks/wien_talks_server/lib/src/generated/endpoints.dart +++ b/wien_talks/wien_talks_server/lib/src/generated/endpoints.dart @@ -11,7 +11,10 @@ // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:serverpod/serverpod.dart' as _i1; import '../greeting_endpoint.dart' as _i2; -import 'package:serverpod_auth_server/serverpod_auth_server.dart' as _i3; +import '../quotes/quotes_endpoint.dart' as _i3; +import 'package:wien_talks_server/src/generated/quotes/create_quote.dart' + as _i4; +import 'package:serverpod_auth_server/serverpod_auth_server.dart' as _i5; class Endpoints extends _i1.EndpointDispatch { @override @@ -22,7 +25,13 @@ class Endpoints extends _i1.EndpointDispatch { server, 'greeting', null, - ) + ), + 'quote': _i3.QuoteEndpoint() + ..initialize( + server, + 'quote', + null, + ), }; connectors['greeting'] = _i1.EndpointConnector( name: 'greeting', @@ -48,6 +57,57 @@ class Endpoints extends _i1.EndpointDispatch { ) }, ); - modules['serverpod_auth'] = _i3.Endpoints()..initializeEndpoints(server); + connectors['quote'] = _i1.EndpointConnector( + name: 'quote', + endpoint: endpoints['quote']!, + methodConnectors: { + 'createQuote': _i1.MethodConnector( + name: 'createQuote', + params: { + 'req': _i1.ParameterDescription( + name: 'req', + type: _i1.getType<_i4.CreateQuoteRequest>(), + nullable: false, + ) + }, + call: ( + _i1.Session session, + Map params, + ) async => + (endpoints['quote'] as _i3.QuoteEndpoint).createQuote( + session, + params['req'], + ), + ), + 'getQuoteById': _i1.MethodConnector( + name: 'getQuoteById', + params: { + 'id': _i1.ParameterDescription( + name: 'id', + type: _i1.getType(), + nullable: false, + ) + }, + call: ( + _i1.Session session, + Map params, + ) async => + (endpoints['quote'] as _i3.QuoteEndpoint).getQuoteById( + session, + params['id'], + ), + ), + 'getAllQuotes': _i1.MethodConnector( + name: 'getAllQuotes', + params: {}, + call: ( + _i1.Session session, + Map params, + ) async => + (endpoints['quote'] as _i3.QuoteEndpoint).getAllQuotes(session), + ), + }, + ); + modules['serverpod_auth'] = _i5.Endpoints()..initializeEndpoints(server); } } diff --git a/wien_talks/wien_talks_server/lib/src/generated/protocol.dart b/wien_talks/wien_talks_server/lib/src/generated/protocol.dart index 74b47bc..8a3b130 100644 --- a/wien_talks/wien_talks_server/lib/src/generated/protocol.dart +++ b/wien_talks/wien_talks_server/lib/src/generated/protocol.dart @@ -15,6 +15,7 @@ import 'package:serverpod_auth_server/serverpod_auth_server.dart' as _i3; import 'greeting.dart' as _i4; import 'quotes/create_quote.dart' as _i5; import 'quotes/quote.dart' as _i6; +import 'package:wien_talks_server/src/generated/quotes/quote.dart' as _i7; export 'greeting.dart'; export 'quotes/create_quote.dart'; export 'quotes/quote.dart'; @@ -157,6 +158,9 @@ class Protocol extends _i1.SerializationManagerServer { ? (data as List).map((e) => deserialize(e)).toList() : null) as T; } + if (t == List<_i7.Quote>) { + return (data as List).map((e) => deserialize<_i7.Quote>(e)).toList() as T; + } try { return _i3.Protocol().deserialize(data, t); } on _i1.DeserializationTypeNotFoundException catch (_) {} diff --git a/wien_talks/wien_talks_server/lib/src/generated/protocol.yaml b/wien_talks/wien_talks_server/lib/src/generated/protocol.yaml index 9a4113d..5c2d35a 100644 --- a/wien_talks/wien_talks_server/lib/src/generated/protocol.yaml +++ b/wien_talks/wien_talks_server/lib/src/generated/protocol.yaml @@ -1,2 +1,6 @@ greeting: - hello: +quote: + - createQuote: + - getQuoteById: + - getAllQuotes: diff --git a/wien_talks/wien_talks_server/lib/src/quotes/quotes_endpoint.dart b/wien_talks/wien_talks_server/lib/src/quotes/quotes_endpoint.dart index 9fc7ded..532d6fc 100644 --- a/wien_talks/wien_talks_server/lib/src/quotes/quotes_endpoint.dart +++ b/wien_talks/wien_talks_server/lib/src/quotes/quotes_endpoint.dart @@ -3,7 +3,7 @@ import 'package:wien_talks_server/src/generated/protocol.dart'; import 'package:wien_talks_server/src/quotes/quote_controller.dart'; class QuoteEndpoint extends Endpoint { - Future create(Session session, CreateQuoteRequest req) async { + Future createQuote(Session session, CreateQuoteRequest req) async { final authInfo = await session.authenticated; final userId = authInfo?.userId; @@ -40,4 +40,23 @@ class QuoteEndpoint extends Endpoint { throw Exception('Quote not found'); } + +// Only for dev + Future> getAllQuotes(Session session) async { + final quotes = await Quote.db.find(session); + return quotes; + } + + Stream streamAllQuotes( + StreamingSession session, { + int limit = 200, + }) async* { + if (limit <= 0 || limit > 500) limit = 200; + + final quoteStream = session.messages.createStream('quotes'); + + await for (final Quote quote in quoteStream) { + yield quote; + } + } } diff --git a/wien_talks/wien_talks_server/migrations/20250816122625449/definition.json b/wien_talks/wien_talks_server/migrations/20250816122625449/definition.json new file mode 100644 index 0000000..025915f --- /dev/null +++ b/wien_talks/wien_talks_server/migrations/20250816122625449/definition.json @@ -0,0 +1,1800 @@ +{ + "moduleName": "wien_talks", + "tables": [ + { + "name": "quote", + "dartName": "Quote", + "module": "wien_talks", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('quote_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "text", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "authorName", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "lat", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "name": "long", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "name": "createdAt", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "name": "visibility", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "upvotes", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "downvotes", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "tags", + "columnType": 8, + "isNullable": true, + "dartType": "List?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "quote_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + } + ], + "managed": true + }, + { + "name": "serverpod_cloud_storage", + "dartName": "CloudStorageEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_cloud_storage_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "storageId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "path", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "addedTime", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "name": "expiration", + "columnType": 4, + "isNullable": true, + "dartType": "DateTime?" + }, + { + "name": "byteData", + "columnType": 5, + "isNullable": false, + "dartType": "dart:typed_data:ByteData" + }, + { + "name": "verified", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_cloud_storage_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_cloud_storage_path_idx", + "elements": [ + { + "type": 0, + "definition": "storageId" + }, + { + "type": 0, + "definition": "path" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + }, + { + "indexName": "serverpod_cloud_storage_expiration", + "elements": [ + { + "type": 0, + "definition": "expiration" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_cloud_storage_direct_upload", + "dartName": "CloudStorageDirectUploadEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_cloud_storage_direct_upload_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "storageId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "path", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "expiration", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "name": "authKey", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_cloud_storage_direct_upload_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_cloud_storage_direct_upload_storage_path", + "elements": [ + { + "type": 0, + "definition": "storageId" + }, + { + "type": 0, + "definition": "path" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_future_call", + "dartName": "FutureCallEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_future_call_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "time", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "name": "serializedObject", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "identifier", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_future_call_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_future_call_time_idx", + "elements": [ + { + "type": 0, + "definition": "time" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + }, + { + "indexName": "serverpod_future_call_serverId_idx", + "elements": [ + { + "type": 0, + "definition": "serverId" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + }, + { + "indexName": "serverpod_future_call_identifier_idx", + "elements": [ + { + "type": 0, + "definition": "identifier" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_health_connection_info", + "dartName": "ServerHealthConnectionInfo", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_health_connection_info_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "timestamp", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "name": "active", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "closing", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "idle", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "granularity", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_health_connection_info_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_health_connection_info_timestamp_idx", + "elements": [ + { + "type": 0, + "definition": "timestamp" + }, + { + "type": 0, + "definition": "serverId" + }, + { + "type": 0, + "definition": "granularity" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_health_metric", + "dartName": "ServerHealthMetric", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_health_metric_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "timestamp", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "name": "isHealthy", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "name": "value", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "name": "granularity", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_health_metric_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_health_metric_timestamp_idx", + "elements": [ + { + "type": 0, + "definition": "timestamp" + }, + { + "type": 0, + "definition": "serverId" + }, + { + "type": 0, + "definition": "name" + }, + { + "type": 0, + "definition": "granularity" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_log", + "dartName": "LogEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_log_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "sessionLogId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "messageId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "name": "reference", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "time", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "name": "logLevel", + "columnType": 6, + "isNullable": false, + "dartType": "protocol:LogLevel" + }, + { + "name": "message", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "error", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "stackTrace", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "order", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [ + { + "constraintName": "serverpod_log_fk_0", + "columns": [ + "sessionLogId" + ], + "referenceTable": "serverpod_session_log", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "indexName": "serverpod_log_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_log_sessionLogId_idx", + "elements": [ + { + "type": 0, + "definition": "sessionLogId" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_message_log", + "dartName": "MessageLogEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_message_log_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "sessionLogId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "messageId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "endpoint", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "messageName", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "duration", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "name": "error", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "stackTrace", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "slow", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "name": "order", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [ + { + "constraintName": "serverpod_message_log_fk_0", + "columns": [ + "sessionLogId" + ], + "referenceTable": "serverpod_session_log", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "indexName": "serverpod_message_log_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + } + ], + "managed": true + }, + { + "name": "serverpod_method", + "dartName": "MethodInfo", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_method_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "endpoint", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "method", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_method_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_method_endpoint_method_idx", + "elements": [ + { + "type": 0, + "definition": "endpoint" + }, + { + "type": 0, + "definition": "method" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_migrations", + "dartName": "DatabaseMigrationVersion", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_migrations_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "module", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "version", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "timestamp", + "columnType": 4, + "isNullable": true, + "dartType": "DateTime?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_migrations_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_migrations_ids", + "elements": [ + { + "type": 0, + "definition": "module" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_query_log", + "dartName": "QueryLogEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_query_log_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "sessionLogId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "messageId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "name": "query", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "duration", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "name": "numRows", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "name": "error", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "stackTrace", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "slow", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "name": "order", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [ + { + "constraintName": "serverpod_query_log_fk_0", + "columns": [ + "sessionLogId" + ], + "referenceTable": "serverpod_session_log", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "indexName": "serverpod_query_log_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_query_log_sessionLogId_idx", + "elements": [ + { + "type": 0, + "definition": "sessionLogId" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_readwrite_test", + "dartName": "ReadWriteTestEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_readwrite_test_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "number", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_readwrite_test_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + } + ], + "managed": true + }, + { + "name": "serverpod_runtime_settings", + "dartName": "RuntimeSettings", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_runtime_settings_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "logSettings", + "columnType": 8, + "isNullable": false, + "dartType": "protocol:LogSettings" + }, + { + "name": "logSettingsOverrides", + "columnType": 8, + "isNullable": false, + "dartType": "List" + }, + { + "name": "logServiceCalls", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "name": "logMalformedCalls", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_runtime_settings_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + } + ], + "managed": true + }, + { + "name": "serverpod_session_log", + "dartName": "SessionLogEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_session_log_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "time", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "name": "module", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "endpoint", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "method", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "duration", + "columnType": 3, + "isNullable": true, + "dartType": "double?" + }, + { + "name": "numQueries", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "name": "slow", + "columnType": 1, + "isNullable": true, + "dartType": "bool?" + }, + { + "name": "error", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "stackTrace", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "authenticatedUserId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "name": "isOpen", + "columnType": 1, + "isNullable": true, + "dartType": "bool?" + }, + { + "name": "touched", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_session_log_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_session_log_serverid_idx", + "elements": [ + { + "type": 0, + "definition": "serverId" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + }, + { + "indexName": "serverpod_session_log_touched_idx", + "elements": [ + { + "type": 0, + "definition": "touched" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + }, + { + "indexName": "serverpod_session_log_isopen_idx", + "elements": [ + { + "type": 0, + "definition": "isOpen" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_auth_key", + "dartName": "AuthKey", + "module": "serverpod_auth", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_auth_key_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "hash", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "scopeNames", + "columnType": 8, + "isNullable": false, + "dartType": "List" + }, + { + "name": "method", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_auth_key_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_auth_key_userId_idx", + "elements": [ + { + "type": 0, + "definition": "userId" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_email_auth", + "dartName": "EmailAuth", + "module": "serverpod_auth", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_email_auth_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "email", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "hash", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_email_auth_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_email_auth_email", + "elements": [ + { + "type": 0, + "definition": "email" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_email_create_request", + "dartName": "EmailCreateAccountRequest", + "module": "serverpod_auth", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_email_create_request_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userName", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "email", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "hash", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "verificationCode", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_email_create_request_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_email_auth_create_account_request_idx", + "elements": [ + { + "type": 0, + "definition": "email" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_email_failed_sign_in", + "dartName": "EmailFailedSignIn", + "module": "serverpod_auth", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_email_failed_sign_in_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "email", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "time", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "name": "ipAddress", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_email_failed_sign_in_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_email_failed_sign_in_email_idx", + "elements": [ + { + "type": 0, + "definition": "email" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + }, + { + "indexName": "serverpod_email_failed_sign_in_time_idx", + "elements": [ + { + "type": 0, + "definition": "time" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_email_reset", + "dartName": "EmailReset", + "module": "serverpod_auth", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_email_reset_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "verificationCode", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "expiration", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_email_reset_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_email_reset_verification_idx", + "elements": [ + { + "type": 0, + "definition": "verificationCode" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_google_refresh_token", + "dartName": "GoogleRefreshToken", + "module": "serverpod_auth", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_google_refresh_token_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "refreshToken", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_google_refresh_token_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_google_refresh_token_userId_idx", + "elements": [ + { + "type": 0, + "definition": "userId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_user_image", + "dartName": "UserImage", + "module": "serverpod_auth", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_user_image_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "version", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "url", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_user_image_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_user_image_user_id", + "elements": [ + { + "type": 0, + "definition": "userId" + }, + { + "type": 0, + "definition": "version" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "name": "serverpod_user_info", + "dartName": "UserInfo", + "module": "serverpod_auth", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_user_info_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userIdentifier", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "userName", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "fullName", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "email", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "created", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "name": "imageUrl", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "scopeNames", + "columnType": 8, + "isNullable": false, + "dartType": "List" + }, + { + "name": "blocked", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_user_info_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_user_info_user_identifier", + "elements": [ + { + "type": 0, + "definition": "userIdentifier" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + }, + { + "indexName": "serverpod_user_info_email", + "elements": [ + { + "type": 0, + "definition": "email" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + } + ], + "installedModules": [ + { + "module": "wien_talks", + "version": "20250816122625449" + }, + { + "module": "serverpod", + "version": "20240516151843329" + }, + { + "module": "serverpod_auth", + "version": "20240520102713718" + } + ], + "migrationApiVersion": 1 +} \ No newline at end of file diff --git a/wien_talks/wien_talks_server/migrations/20250816122625449/definition.sql b/wien_talks/wien_talks_server/migrations/20250816122625449/definition.sql new file mode 100644 index 0000000..93fb32c --- /dev/null +++ b/wien_talks/wien_talks_server/migrations/20250816122625449/definition.sql @@ -0,0 +1,394 @@ +BEGIN; + +-- +-- Class Quote as table quote +-- +CREATE TABLE "quote" ( + "id" bigserial PRIMARY KEY, + "userId" bigint NOT NULL, + "text" text NOT NULL, + "authorName" text, + "lat" double precision NOT NULL, + "long" double precision NOT NULL, + "createdAt" timestamp without time zone NOT NULL, + "visibility" bigint NOT NULL, + "upvotes" bigint NOT NULL, + "downvotes" bigint NOT NULL, + "tags" json +); + +-- +-- Class CloudStorageEntry as table serverpod_cloud_storage +-- +CREATE TABLE "serverpod_cloud_storage" ( + "id" bigserial PRIMARY KEY, + "storageId" text NOT NULL, + "path" text NOT NULL, + "addedTime" timestamp without time zone NOT NULL, + "expiration" timestamp without time zone, + "byteData" bytea NOT NULL, + "verified" boolean NOT NULL +); + +-- Indexes +CREATE UNIQUE INDEX "serverpod_cloud_storage_path_idx" ON "serverpod_cloud_storage" USING btree ("storageId", "path"); +CREATE INDEX "serverpod_cloud_storage_expiration" ON "serverpod_cloud_storage" USING btree ("expiration"); + +-- +-- Class CloudStorageDirectUploadEntry as table serverpod_cloud_storage_direct_upload +-- +CREATE TABLE "serverpod_cloud_storage_direct_upload" ( + "id" bigserial PRIMARY KEY, + "storageId" text NOT NULL, + "path" text NOT NULL, + "expiration" timestamp without time zone NOT NULL, + "authKey" text NOT NULL +); + +-- Indexes +CREATE UNIQUE INDEX "serverpod_cloud_storage_direct_upload_storage_path" ON "serverpod_cloud_storage_direct_upload" USING btree ("storageId", "path"); + +-- +-- Class FutureCallEntry as table serverpod_future_call +-- +CREATE TABLE "serverpod_future_call" ( + "id" bigserial PRIMARY KEY, + "name" text NOT NULL, + "time" timestamp without time zone NOT NULL, + "serializedObject" text, + "serverId" text NOT NULL, + "identifier" text +); + +-- Indexes +CREATE INDEX "serverpod_future_call_time_idx" ON "serverpod_future_call" USING btree ("time"); +CREATE INDEX "serverpod_future_call_serverId_idx" ON "serverpod_future_call" USING btree ("serverId"); +CREATE INDEX "serverpod_future_call_identifier_idx" ON "serverpod_future_call" USING btree ("identifier"); + +-- +-- Class ServerHealthConnectionInfo as table serverpod_health_connection_info +-- +CREATE TABLE "serverpod_health_connection_info" ( + "id" bigserial PRIMARY KEY, + "serverId" text NOT NULL, + "timestamp" timestamp without time zone NOT NULL, + "active" bigint NOT NULL, + "closing" bigint NOT NULL, + "idle" bigint NOT NULL, + "granularity" bigint NOT NULL +); + +-- Indexes +CREATE UNIQUE INDEX "serverpod_health_connection_info_timestamp_idx" ON "serverpod_health_connection_info" USING btree ("timestamp", "serverId", "granularity"); + +-- +-- Class ServerHealthMetric as table serverpod_health_metric +-- +CREATE TABLE "serverpod_health_metric" ( + "id" bigserial PRIMARY KEY, + "name" text NOT NULL, + "serverId" text NOT NULL, + "timestamp" timestamp without time zone NOT NULL, + "isHealthy" boolean NOT NULL, + "value" double precision NOT NULL, + "granularity" bigint NOT NULL +); + +-- Indexes +CREATE UNIQUE INDEX "serverpod_health_metric_timestamp_idx" ON "serverpod_health_metric" USING btree ("timestamp", "serverId", "name", "granularity"); + +-- +-- Class LogEntry as table serverpod_log +-- +CREATE TABLE "serverpod_log" ( + "id" bigserial PRIMARY KEY, + "sessionLogId" bigint NOT NULL, + "messageId" bigint, + "reference" text, + "serverId" text NOT NULL, + "time" timestamp without time zone NOT NULL, + "logLevel" bigint NOT NULL, + "message" text NOT NULL, + "error" text, + "stackTrace" text, + "order" bigint NOT NULL +); + +-- Indexes +CREATE INDEX "serverpod_log_sessionLogId_idx" ON "serverpod_log" USING btree ("sessionLogId"); + +-- +-- Class MessageLogEntry as table serverpod_message_log +-- +CREATE TABLE "serverpod_message_log" ( + "id" bigserial PRIMARY KEY, + "sessionLogId" bigint NOT NULL, + "serverId" text NOT NULL, + "messageId" bigint NOT NULL, + "endpoint" text NOT NULL, + "messageName" text NOT NULL, + "duration" double precision NOT NULL, + "error" text, + "stackTrace" text, + "slow" boolean NOT NULL, + "order" bigint NOT NULL +); + +-- +-- Class MethodInfo as table serverpod_method +-- +CREATE TABLE "serverpod_method" ( + "id" bigserial PRIMARY KEY, + "endpoint" text NOT NULL, + "method" text NOT NULL +); + +-- Indexes +CREATE UNIQUE INDEX "serverpod_method_endpoint_method_idx" ON "serverpod_method" USING btree ("endpoint", "method"); + +-- +-- Class DatabaseMigrationVersion as table serverpod_migrations +-- +CREATE TABLE "serverpod_migrations" ( + "id" bigserial PRIMARY KEY, + "module" text NOT NULL, + "version" text NOT NULL, + "timestamp" timestamp without time zone +); + +-- Indexes +CREATE UNIQUE INDEX "serverpod_migrations_ids" ON "serverpod_migrations" USING btree ("module"); + +-- +-- Class QueryLogEntry as table serverpod_query_log +-- +CREATE TABLE "serverpod_query_log" ( + "id" bigserial PRIMARY KEY, + "serverId" text NOT NULL, + "sessionLogId" bigint NOT NULL, + "messageId" bigint, + "query" text NOT NULL, + "duration" double precision NOT NULL, + "numRows" bigint, + "error" text, + "stackTrace" text, + "slow" boolean NOT NULL, + "order" bigint NOT NULL +); + +-- Indexes +CREATE INDEX "serverpod_query_log_sessionLogId_idx" ON "serverpod_query_log" USING btree ("sessionLogId"); + +-- +-- Class ReadWriteTestEntry as table serverpod_readwrite_test +-- +CREATE TABLE "serverpod_readwrite_test" ( + "id" bigserial PRIMARY KEY, + "number" bigint NOT NULL +); + +-- +-- Class RuntimeSettings as table serverpod_runtime_settings +-- +CREATE TABLE "serverpod_runtime_settings" ( + "id" bigserial PRIMARY KEY, + "logSettings" json NOT NULL, + "logSettingsOverrides" json NOT NULL, + "logServiceCalls" boolean NOT NULL, + "logMalformedCalls" boolean NOT NULL +); + +-- +-- Class SessionLogEntry as table serverpod_session_log +-- +CREATE TABLE "serverpod_session_log" ( + "id" bigserial PRIMARY KEY, + "serverId" text NOT NULL, + "time" timestamp without time zone NOT NULL, + "module" text, + "endpoint" text, + "method" text, + "duration" double precision, + "numQueries" bigint, + "slow" boolean, + "error" text, + "stackTrace" text, + "authenticatedUserId" bigint, + "isOpen" boolean, + "touched" timestamp without time zone NOT NULL +); + +-- Indexes +CREATE INDEX "serverpod_session_log_serverid_idx" ON "serverpod_session_log" USING btree ("serverId"); +CREATE INDEX "serverpod_session_log_touched_idx" ON "serverpod_session_log" USING btree ("touched"); +CREATE INDEX "serverpod_session_log_isopen_idx" ON "serverpod_session_log" USING btree ("isOpen"); + +-- +-- Class AuthKey as table serverpod_auth_key +-- +CREATE TABLE "serverpod_auth_key" ( + "id" bigserial PRIMARY KEY, + "userId" bigint NOT NULL, + "hash" text NOT NULL, + "scopeNames" json NOT NULL, + "method" text NOT NULL +); + +-- Indexes +CREATE INDEX "serverpod_auth_key_userId_idx" ON "serverpod_auth_key" USING btree ("userId"); + +-- +-- Class EmailAuth as table serverpod_email_auth +-- +CREATE TABLE "serverpod_email_auth" ( + "id" bigserial PRIMARY KEY, + "userId" bigint NOT NULL, + "email" text NOT NULL, + "hash" text NOT NULL +); + +-- Indexes +CREATE UNIQUE INDEX "serverpod_email_auth_email" ON "serverpod_email_auth" USING btree ("email"); + +-- +-- Class EmailCreateAccountRequest as table serverpod_email_create_request +-- +CREATE TABLE "serverpod_email_create_request" ( + "id" bigserial PRIMARY KEY, + "userName" text NOT NULL, + "email" text NOT NULL, + "hash" text NOT NULL, + "verificationCode" text NOT NULL +); + +-- Indexes +CREATE UNIQUE INDEX "serverpod_email_auth_create_account_request_idx" ON "serverpod_email_create_request" USING btree ("email"); + +-- +-- Class EmailFailedSignIn as table serverpod_email_failed_sign_in +-- +CREATE TABLE "serverpod_email_failed_sign_in" ( + "id" bigserial PRIMARY KEY, + "email" text NOT NULL, + "time" timestamp without time zone NOT NULL, + "ipAddress" text NOT NULL +); + +-- Indexes +CREATE INDEX "serverpod_email_failed_sign_in_email_idx" ON "serverpod_email_failed_sign_in" USING btree ("email"); +CREATE INDEX "serverpod_email_failed_sign_in_time_idx" ON "serverpod_email_failed_sign_in" USING btree ("time"); + +-- +-- Class EmailReset as table serverpod_email_reset +-- +CREATE TABLE "serverpod_email_reset" ( + "id" bigserial PRIMARY KEY, + "userId" bigint NOT NULL, + "verificationCode" text NOT NULL, + "expiration" timestamp without time zone NOT NULL +); + +-- Indexes +CREATE UNIQUE INDEX "serverpod_email_reset_verification_idx" ON "serverpod_email_reset" USING btree ("verificationCode"); + +-- +-- Class GoogleRefreshToken as table serverpod_google_refresh_token +-- +CREATE TABLE "serverpod_google_refresh_token" ( + "id" bigserial PRIMARY KEY, + "userId" bigint NOT NULL, + "refreshToken" text NOT NULL +); + +-- Indexes +CREATE UNIQUE INDEX "serverpod_google_refresh_token_userId_idx" ON "serverpod_google_refresh_token" USING btree ("userId"); + +-- +-- Class UserImage as table serverpod_user_image +-- +CREATE TABLE "serverpod_user_image" ( + "id" bigserial PRIMARY KEY, + "userId" bigint NOT NULL, + "version" bigint NOT NULL, + "url" text NOT NULL +); + +-- Indexes +CREATE INDEX "serverpod_user_image_user_id" ON "serverpod_user_image" USING btree ("userId", "version"); + +-- +-- Class UserInfo as table serverpod_user_info +-- +CREATE TABLE "serverpod_user_info" ( + "id" bigserial PRIMARY KEY, + "userIdentifier" text NOT NULL, + "userName" text, + "fullName" text, + "email" text, + "created" timestamp without time zone NOT NULL, + "imageUrl" text, + "scopeNames" json NOT NULL, + "blocked" boolean NOT NULL +); + +-- Indexes +CREATE UNIQUE INDEX "serverpod_user_info_user_identifier" ON "serverpod_user_info" USING btree ("userIdentifier"); +CREATE INDEX "serverpod_user_info_email" ON "serverpod_user_info" USING btree ("email"); + +-- +-- Foreign relations for "serverpod_log" table +-- +ALTER TABLE ONLY "serverpod_log" + ADD CONSTRAINT "serverpod_log_fk_0" + FOREIGN KEY("sessionLogId") + REFERENCES "serverpod_session_log"("id") + ON DELETE CASCADE + ON UPDATE NO ACTION; + +-- +-- Foreign relations for "serverpod_message_log" table +-- +ALTER TABLE ONLY "serverpod_message_log" + ADD CONSTRAINT "serverpod_message_log_fk_0" + FOREIGN KEY("sessionLogId") + REFERENCES "serverpod_session_log"("id") + ON DELETE CASCADE + ON UPDATE NO ACTION; + +-- +-- Foreign relations for "serverpod_query_log" table +-- +ALTER TABLE ONLY "serverpod_query_log" + ADD CONSTRAINT "serverpod_query_log_fk_0" + FOREIGN KEY("sessionLogId") + REFERENCES "serverpod_session_log"("id") + ON DELETE CASCADE + ON UPDATE NO ACTION; + + +-- +-- MIGRATION VERSION FOR wien_talks +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('wien_talks', '20250816122625449', now()) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20250816122625449', "timestamp" = now(); + +-- +-- MIGRATION VERSION FOR serverpod +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod', '20240516151843329', now()) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20240516151843329', "timestamp" = now(); + +-- +-- MIGRATION VERSION FOR serverpod_auth +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod_auth', '20240520102713718', now()) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20240520102713718', "timestamp" = now(); + + +COMMIT; diff --git a/wien_talks/wien_talks_server/migrations/20250816122625449/definition_project.json b/wien_talks/wien_talks_server/migrations/20250816122625449/definition_project.json new file mode 100644 index 0000000..d649d10 --- /dev/null +++ b/wien_talks/wien_talks_server/migrations/20250816122625449/definition_project.json @@ -0,0 +1,107 @@ +{ + "moduleName": "wien_talks", + "tables": [ + { + "name": "quote", + "dartName": "Quote", + "module": "wien_talks", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('quote_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "text", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "authorName", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "lat", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "name": "long", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "name": "createdAt", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "name": "visibility", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "upvotes", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "downvotes", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "tags", + "columnType": 8, + "isNullable": true, + "dartType": "List?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "quote_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + } + ], + "managed": true + } + ], + "installedModules": [ + { + "module": "serverpod", + "version": "20240516151843329" + }, + { + "module": "serverpod_auth", + "version": "20240520102713718" + } + ], + "migrationApiVersion": 1 +} \ No newline at end of file diff --git a/wien_talks/wien_talks_server/migrations/20250816122625449/migration.json b/wien_talks/wien_talks_server/migrations/20250816122625449/migration.json new file mode 100644 index 0000000..c35478a --- /dev/null +++ b/wien_talks/wien_talks_server/migrations/20250816122625449/migration.json @@ -0,0 +1,676 @@ +{ + "actions": [ + { + "type": "createTable", + "createTable": { + "name": "quote", + "dartName": "Quote", + "module": "wien_talks", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('quote_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "text", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "authorName", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "lat", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "name": "long", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "name": "createdAt", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "name": "visibility", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "upvotes", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "downvotes", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "tags", + "columnType": 8, + "isNullable": true, + "dartType": "List?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "quote_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + } + ], + "managed": true + } + }, + { + "type": "createTable", + "createTable": { + "name": "serverpod_auth_key", + "dartName": "AuthKey", + "module": "serverpod_auth", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_auth_key_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "hash", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "scopeNames", + "columnType": 8, + "isNullable": false, + "dartType": "List" + }, + { + "name": "method", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_auth_key_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_auth_key_userId_idx", + "elements": [ + { + "type": 0, + "definition": "userId" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + } + }, + { + "type": "createTable", + "createTable": { + "name": "serverpod_email_auth", + "dartName": "EmailAuth", + "module": "serverpod_auth", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_email_auth_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "email", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "hash", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_email_auth_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_email_auth_email", + "elements": [ + { + "type": 0, + "definition": "email" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + } + }, + { + "type": "createTable", + "createTable": { + "name": "serverpod_email_create_request", + "dartName": "EmailCreateAccountRequest", + "module": "serverpod_auth", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_email_create_request_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userName", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "email", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "hash", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "verificationCode", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_email_create_request_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_email_auth_create_account_request_idx", + "elements": [ + { + "type": 0, + "definition": "email" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + } + }, + { + "type": "createTable", + "createTable": { + "name": "serverpod_email_failed_sign_in", + "dartName": "EmailFailedSignIn", + "module": "serverpod_auth", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_email_failed_sign_in_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "email", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "time", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "name": "ipAddress", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_email_failed_sign_in_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_email_failed_sign_in_email_idx", + "elements": [ + { + "type": 0, + "definition": "email" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + }, + { + "indexName": "serverpod_email_failed_sign_in_time_idx", + "elements": [ + { + "type": 0, + "definition": "time" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + } + }, + { + "type": "createTable", + "createTable": { + "name": "serverpod_email_reset", + "dartName": "EmailReset", + "module": "serverpod_auth", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_email_reset_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "verificationCode", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "expiration", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_email_reset_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_email_reset_verification_idx", + "elements": [ + { + "type": 0, + "definition": "verificationCode" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + } + }, + { + "type": "createTable", + "createTable": { + "name": "serverpod_google_refresh_token", + "dartName": "GoogleRefreshToken", + "module": "serverpod_auth", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_google_refresh_token_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "refreshToken", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_google_refresh_token_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_google_refresh_token_userId_idx", + "elements": [ + { + "type": 0, + "definition": "userId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + } + }, + { + "type": "createTable", + "createTable": { + "name": "serverpod_user_image", + "dartName": "UserImage", + "module": "serverpod_auth", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_user_image_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "version", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "name": "url", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_user_image_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_user_image_user_id", + "elements": [ + { + "type": 0, + "definition": "userId" + }, + { + "type": 0, + "definition": "version" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + } + }, + { + "type": "createTable", + "createTable": { + "name": "serverpod_user_info", + "dartName": "UserInfo", + "module": "serverpod_auth", + "schema": "public", + "columns": [ + { + "name": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "nextval('serverpod_user_info_id_seq'::regclass)", + "dartType": "int?" + }, + { + "name": "userIdentifier", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "name": "userName", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "fullName", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "email", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "created", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "name": "imageUrl", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "name": "scopeNames", + "columnType": 8, + "isNullable": false, + "dartType": "List" + }, + { + "name": "blocked", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + } + ], + "foreignKeys": [], + "indexes": [ + { + "indexName": "serverpod_user_info_pkey", + "elements": [ + { + "type": 0, + "definition": "id" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": true + }, + { + "indexName": "serverpod_user_info_user_identifier", + "elements": [ + { + "type": 0, + "definition": "userIdentifier" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + }, + { + "indexName": "serverpod_user_info_email", + "elements": [ + { + "type": 0, + "definition": "email" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + } + } + ], + "warnings": [], + "migrationApiVersion": 1 +} \ No newline at end of file diff --git a/wien_talks/wien_talks_server/migrations/20250816122625449/migration.sql b/wien_talks/wien_talks_server/migrations/20250816122625449/migration.sql new file mode 100644 index 0000000..a0392e6 --- /dev/null +++ b/wien_talks/wien_talks_server/migrations/20250816122625449/migration.sql @@ -0,0 +1,158 @@ +BEGIN; + +-- +-- ACTION CREATE TABLE +-- +CREATE TABLE "quote" ( + "id" bigserial PRIMARY KEY, + "userId" bigint NOT NULL, + "text" text NOT NULL, + "authorName" text, + "lat" double precision NOT NULL, + "long" double precision NOT NULL, + "createdAt" timestamp without time zone NOT NULL, + "visibility" bigint NOT NULL, + "upvotes" bigint NOT NULL, + "downvotes" bigint NOT NULL, + "tags" json +); + +-- +-- ACTION CREATE TABLE +-- +CREATE TABLE "serverpod_auth_key" ( + "id" bigserial PRIMARY KEY, + "userId" bigint NOT NULL, + "hash" text NOT NULL, + "scopeNames" json NOT NULL, + "method" text NOT NULL +); + +-- Indexes +CREATE INDEX "serverpod_auth_key_userId_idx" ON "serverpod_auth_key" USING btree ("userId"); + +-- +-- ACTION CREATE TABLE +-- +CREATE TABLE "serverpod_email_auth" ( + "id" bigserial PRIMARY KEY, + "userId" bigint NOT NULL, + "email" text NOT NULL, + "hash" text NOT NULL +); + +-- Indexes +CREATE UNIQUE INDEX "serverpod_email_auth_email" ON "serverpod_email_auth" USING btree ("email"); + +-- +-- ACTION CREATE TABLE +-- +CREATE TABLE "serverpod_email_create_request" ( + "id" bigserial PRIMARY KEY, + "userName" text NOT NULL, + "email" text NOT NULL, + "hash" text NOT NULL, + "verificationCode" text NOT NULL +); + +-- Indexes +CREATE UNIQUE INDEX "serverpod_email_auth_create_account_request_idx" ON "serverpod_email_create_request" USING btree ("email"); + +-- +-- ACTION CREATE TABLE +-- +CREATE TABLE "serverpod_email_failed_sign_in" ( + "id" bigserial PRIMARY KEY, + "email" text NOT NULL, + "time" timestamp without time zone NOT NULL, + "ipAddress" text NOT NULL +); + +-- Indexes +CREATE INDEX "serverpod_email_failed_sign_in_email_idx" ON "serverpod_email_failed_sign_in" USING btree ("email"); +CREATE INDEX "serverpod_email_failed_sign_in_time_idx" ON "serverpod_email_failed_sign_in" USING btree ("time"); + +-- +-- ACTION CREATE TABLE +-- +CREATE TABLE "serverpod_email_reset" ( + "id" bigserial PRIMARY KEY, + "userId" bigint NOT NULL, + "verificationCode" text NOT NULL, + "expiration" timestamp without time zone NOT NULL +); + +-- Indexes +CREATE UNIQUE INDEX "serverpod_email_reset_verification_idx" ON "serverpod_email_reset" USING btree ("verificationCode"); + +-- +-- ACTION CREATE TABLE +-- +CREATE TABLE "serverpod_google_refresh_token" ( + "id" bigserial PRIMARY KEY, + "userId" bigint NOT NULL, + "refreshToken" text NOT NULL +); + +-- Indexes +CREATE UNIQUE INDEX "serverpod_google_refresh_token_userId_idx" ON "serverpod_google_refresh_token" USING btree ("userId"); + +-- +-- ACTION CREATE TABLE +-- +CREATE TABLE "serverpod_user_image" ( + "id" bigserial PRIMARY KEY, + "userId" bigint NOT NULL, + "version" bigint NOT NULL, + "url" text NOT NULL +); + +-- Indexes +CREATE INDEX "serverpod_user_image_user_id" ON "serverpod_user_image" USING btree ("userId", "version"); + +-- +-- ACTION CREATE TABLE +-- +CREATE TABLE "serverpod_user_info" ( + "id" bigserial PRIMARY KEY, + "userIdentifier" text NOT NULL, + "userName" text, + "fullName" text, + "email" text, + "created" timestamp without time zone NOT NULL, + "imageUrl" text, + "scopeNames" json NOT NULL, + "blocked" boolean NOT NULL +); + +-- Indexes +CREATE UNIQUE INDEX "serverpod_user_info_user_identifier" ON "serverpod_user_info" USING btree ("userIdentifier"); +CREATE INDEX "serverpod_user_info_email" ON "serverpod_user_info" USING btree ("email"); + + +-- +-- MIGRATION VERSION FOR wien_talks +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('wien_talks', '20250816122625449', now()) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20250816122625449', "timestamp" = now(); + +-- +-- MIGRATION VERSION FOR serverpod +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod', '20240516151843329', now()) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20240516151843329', "timestamp" = now(); + +-- +-- MIGRATION VERSION FOR serverpod_auth +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod_auth', '20240520102713718', now()) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20240520102713718', "timestamp" = now(); + + +COMMIT; diff --git a/wien_talks/wien_talks_server/migrations/migration_registry.txt b/wien_talks/wien_talks_server/migrations/migration_registry.txt index a0ec0ac..26980aa 100644 --- a/wien_talks/wien_talks_server/migrations/migration_registry.txt +++ b/wien_talks/wien_talks_server/migrations/migration_registry.txt @@ -5,3 +5,4 @@ ### the conflict by removing and recreating the conflicting migration. 20250816095813247 +20250816122625449 diff --git a/wien_talks/wien_talks_server/test/integration/test_tools/serverpod_test_tools.dart b/wien_talks/wien_talks_server/test/integration/test_tools/serverpod_test_tools.dart index d9ec37d..e06e769 100644 --- a/wien_talks/wien_talks_server/test/integration/test_tools/serverpod_test_tools.dart +++ b/wien_talks/wien_talks_server/test/integration/test_tools/serverpod_test_tools.dart @@ -15,6 +15,9 @@ import 'package:serverpod_test/serverpod_test.dart' as _i1; import 'package:serverpod/serverpod.dart' as _i2; import 'dart:async' as _i3; import 'package:wien_talks_server/src/generated/greeting.dart' as _i4; +import 'package:wien_talks_server/src/generated/quotes/quote.dart' as _i5; +import 'package:wien_talks_server/src/generated/quotes/create_quote.dart' + as _i6; import 'package:wien_talks_server/src/generated/protocol.dart'; import 'package:wien_talks_server/src/generated/endpoints.dart'; export 'package:serverpod_test/serverpod_test_public_exports.dart'; @@ -102,6 +105,8 @@ void withServerpod( class TestEndpoints { late final _GreetingEndpoint greeting; + + late final _QuoteEndpoint quote; } class _InternalTestEndpoints extends TestEndpoints @@ -115,6 +120,10 @@ class _InternalTestEndpoints extends TestEndpoints endpoints, serializationManager, ); + quote = _QuoteEndpoint( + endpoints, + serializationManager, + ); } } @@ -157,3 +166,99 @@ class _GreetingEndpoint { }); } } + +class _QuoteEndpoint { + _QuoteEndpoint( + this._endpointDispatch, + this._serializationManager, + ); + + final _i2.EndpointDispatch _endpointDispatch; + + final _i2.SerializationManager _serializationManager; + + _i3.Future<_i5.Quote> createQuote( + _i1.TestSessionBuilder sessionBuilder, + _i6.CreateQuoteRequest req, + ) async { + return _i1.callAwaitableFunctionAndHandleExceptions(() async { + var _localUniqueSession = + (sessionBuilder as _i1.InternalTestSessionBuilder).internalBuild( + endpoint: 'quote', + method: 'createQuote', + ); + try { + var _localCallContext = await _endpointDispatch.getMethodCallContext( + createSessionCallback: (_) => _localUniqueSession, + endpointPath: 'quote', + methodName: 'createQuote', + parameters: _i1.testObjectToJson({'req': req}), + serializationManager: _serializationManager, + ); + var _localReturnValue = await (_localCallContext.method.call( + _localUniqueSession, + _localCallContext.arguments, + ) as _i3.Future<_i5.Quote>); + return _localReturnValue; + } finally { + await _localUniqueSession.close(); + } + }); + } + + _i3.Future<_i5.Quote> getQuoteById( + _i1.TestSessionBuilder sessionBuilder, + int id, + ) async { + return _i1.callAwaitableFunctionAndHandleExceptions(() async { + var _localUniqueSession = + (sessionBuilder as _i1.InternalTestSessionBuilder).internalBuild( + endpoint: 'quote', + method: 'getQuoteById', + ); + try { + var _localCallContext = await _endpointDispatch.getMethodCallContext( + createSessionCallback: (_) => _localUniqueSession, + endpointPath: 'quote', + methodName: 'getQuoteById', + parameters: _i1.testObjectToJson({'id': id}), + serializationManager: _serializationManager, + ); + var _localReturnValue = await (_localCallContext.method.call( + _localUniqueSession, + _localCallContext.arguments, + ) as _i3.Future<_i5.Quote>); + return _localReturnValue; + } finally { + await _localUniqueSession.close(); + } + }); + } + + _i3.Future> getAllQuotes( + _i1.TestSessionBuilder sessionBuilder) async { + return _i1.callAwaitableFunctionAndHandleExceptions(() async { + var _localUniqueSession = + (sessionBuilder as _i1.InternalTestSessionBuilder).internalBuild( + endpoint: 'quote', + method: 'getAllQuotes', + ); + try { + var _localCallContext = await _endpointDispatch.getMethodCallContext( + createSessionCallback: (_) => _localUniqueSession, + endpointPath: 'quote', + methodName: 'getAllQuotes', + parameters: _i1.testObjectToJson({}), + serializationManager: _serializationManager, + ); + var _localReturnValue = await (_localCallContext.method.call( + _localUniqueSession, + _localCallContext.arguments, + ) as _i3.Future>); + return _localReturnValue; + } finally { + await _localUniqueSession.close(); + } + }); + } +}