zitadel/migrations/cockroach/V1.7__notification.sql

70 lines
1.2 KiB
MySQL
Raw Normal View History

feat: notifications (#109) * implement notification providers * email provider * notification handler * notify users * implement code sent on user eventstore * send email implementation * send init code * handle codes * fix project member handler * add some logs for debug * send emails * text changes * send sms * notification process * send password code * format phone number * test format phone * remove fmts * remove unused code * rename files * add mocks * merge master * Update internal/notification/providers/email/message.go Co-authored-by: Silvan <silvan.reusser@gmail.com> * Update internal/notification/repository/eventsourcing/handler/notification.go Co-authored-by: Silvan <silvan.reusser@gmail.com> * Update internal/notification/repository/eventsourcing/handler/notification.go Co-authored-by: Silvan <silvan.reusser@gmail.com> * Update internal/notification/providers/email/provider.go Co-authored-by: Silvan <silvan.reusser@gmail.com> * requested changes of mr * move locker to eventstore pkg * Update internal/notification/providers/chat/message.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * move locker to eventstore pkg * linebreak * Update internal/notification/providers/email/provider.go Co-authored-by: Silvan <silvan.reusser@gmail.com> * Update internal/notification/repository/eventsourcing/handler/notification.go Co-authored-by: Silvan <silvan.reusser@gmail.com> * Update internal/notification/repository/eventsourcing/handler/notification.go Co-authored-by: Silvan <silvan.reusser@gmail.com> Co-authored-by: Silvan <silvan.reusser@gmail.com> Co-authored-by: Livio Amstutz <livio.a@gmail.com>
2020-05-20 12:28:08 +00:00
BEGIN;
CREATE DATABASE notification;
COMMIT;
BEGIN;
CREATE USER notification;
GRANT SELECT, INSERT, UPDATE, DELETE ON DATABASE notification TO notification;
GRANT SELECT, INSERT, UPDATE ON DATABASE eventstore TO notification;
GRANT SELECT, INSERT, UPDATE ON TABLE eventstore.* TO notification;
COMMIT;
BEGIN;
CREATE TABLE notification.locks (
locker_id TEXT,
locked_until TIMESTAMPTZ,
object_type TEXT,
PRIMARY KEY (object_type)
);
CREATE TABLE notification.current_sequences (
view_name TEXT,
current_sequence BIGINT,
PRIMARY KEY (view_name)
);
CREATE TABLE notification.failed_event (
view_name TEXT,
failed_sequence BIGINT,
failure_count SMALLINT,
err_msg TEXT,
PRIMARY KEY (view_name, failed_sequence)
);
CREATE TABLE notification.notify_users (
id TEXT,
creation_date TIMESTAMPTZ,
change_date TIMESTAMPTZ,
resource_owner TEXT,
user_name TEXT,
first_name TEXT,
last_name TEXT,
nick_Name TEXT,
display_name TEXT,
preferred_language TEXT,
gender SMALLINT,
last_email TEXT,
verified_email TEXT,
last_phone TEXT,
verified_phone TEXT,
sequence BIGINT,
PRIMARY KEY (id)
);
COMMIT;