mirror of
https://github.com/timokz/flutter-vienna-hackathon-25.git
synced 2025-11-08 19:04:20 +01:00
migrate db
This commit is contained in:
parent
4ad511cc92
commit
6f75132073
18 changed files with 3402 additions and 14 deletions
|
|
@ -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<List<_i4.Quote>> getAllQuotes() =>
|
||||
caller.callServerEndpoint<List<_i4.Quote>>(
|
||||
'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<String, _i1.EndpointRef> get endpointRefLookup => {'greeting': greeting};
|
||||
Map<String, _i1.EndpointRef> get endpointRefLookup => {
|
||||
'greeting': greeting,
|
||||
'quote': quote,
|
||||
};
|
||||
|
||||
@override
|
||||
Map<String, _i1.ModuleEndpointCaller> get moduleLookup =>
|
||||
|
|
|
|||
|
|
@ -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<String>(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<T>(data, t);
|
||||
return _i6.Protocol().deserialize<T>(data, t);
|
||||
} on _i1.DeserializationTypeNotFoundException catch (_) {}
|
||||
return super.deserialize<T>(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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <file_selector_linux/file_selector_plugin.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
file_selector_linux
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
|
|
|
|||
|
|
@ -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"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,11 @@
|
|||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <connectivity_plus/connectivity_plus_windows_plugin.h>
|
||||
#include <file_selector_windows/file_selector_windows.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
ConnectivityPlusWindowsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
|
||||
FileSelectorWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FileSelectorWindows"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
connectivity_plus
|
||||
file_selector_windows
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
|
|
|
|||
|
|
@ -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<String, dynamic> 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<int>(),
|
||||
nullable: false,
|
||||
)
|
||||
},
|
||||
call: (
|
||||
_i1.Session session,
|
||||
Map<String, dynamic> params,
|
||||
) async =>
|
||||
(endpoints['quote'] as _i3.QuoteEndpoint).getQuoteById(
|
||||
session,
|
||||
params['id'],
|
||||
),
|
||||
),
|
||||
'getAllQuotes': _i1.MethodConnector(
|
||||
name: 'getAllQuotes',
|
||||
params: {},
|
||||
call: (
|
||||
_i1.Session session,
|
||||
Map<String, dynamic> params,
|
||||
) async =>
|
||||
(endpoints['quote'] as _i3.QuoteEndpoint).getAllQuotes(session),
|
||||
),
|
||||
},
|
||||
);
|
||||
modules['serverpod_auth'] = _i5.Endpoints()..initializeEndpoints(server);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<String>(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<T>(data, t);
|
||||
} on _i1.DeserializationTypeNotFoundException catch (_) {}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,6 @@
|
|||
greeting:
|
||||
- hello:
|
||||
quote:
|
||||
- createQuote:
|
||||
- getQuoteById:
|
||||
- getAllQuotes:
|
||||
|
|
|
|||
|
|
@ -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<Quote> create(Session session, CreateQuoteRequest req) async {
|
||||
Future<Quote> 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<List<Quote>> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -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;
|
||||
|
|
@ -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<String>?"
|
||||
}
|
||||
],
|
||||
"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
|
||||
}
|
||||
|
|
@ -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<String>?"
|
||||
}
|
||||
],
|
||||
"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<String>"
|
||||
},
|
||||
{
|
||||
"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<String>"
|
||||
},
|
||||
{
|
||||
"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
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
@ -5,3 +5,4 @@
|
|||
### the conflict by removing and recreating the conflicting migration.
|
||||
|
||||
20250816095813247
|
||||
20250816122625449
|
||||
|
|
|
|||
|
|
@ -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<List<_i5.Quote>> 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<List<_i5.Quote>>);
|
||||
return _localReturnValue;
|
||||
} finally {
|
||||
await _localUniqueSession.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue