meta_notification 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/meta_notification/api/v1/user_notifications_controller.rb +69 -59
- data/app/controllers/meta_notification/application_controller.rb +1 -1
- data/lib/meta_notification/version.rb +1 -1
- data/spec/dummy/log/development.log +243 -36
- data/spec/dummy/log/test.log +1189 -7
- metadata +68 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fb5e04a46b4432cbeea71d776128cd0fd984665
|
4
|
+
data.tar.gz: bb152517635df8dd99395bc2eaa13d7f9dff0096
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af1c48d7e73c22ac1a257eb873572ad42e3d4d17cb5e7abf19b16f978d567287426ab6cb7f5e6dd4993527168c526a63d4394a31e36d7db7fc0f376f587bc2e9
|
7
|
+
data.tar.gz: e5648b1fec230466146184af05262ee0608b8e292f0cf5f29aceffb85c3f143e0f5c1a0724e1055d873fadf007e63270f5ba9af8ce5032967a2821fb7340fa08
|
@@ -1,75 +1,85 @@
|
|
1
1
|
require_dependency 'meta_notification/application_controller'
|
2
|
-
require
|
2
|
+
require 'meta_notification_authority'
|
3
3
|
|
4
4
|
module MetaNotification
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
module Api
|
6
|
+
module V1
|
7
|
+
class UserNotificationsController < ApplicationController
|
8
|
+
before_action :init_authorizer
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
before_action :set_user_notification, only: [:update, :show]
|
11
|
+
before_action :set_notification_type_ids_for_filter, only: [:notifications, :mark_all_read, :mark_all_read]
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
def show
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
def update
|
17
|
+
if @user_notifications_authorizer.updatable_by?(current_user, @user_notification)
|
18
|
+
@user_notification.update(user_notification_params)
|
19
|
+
render(json: { marked: true }, status: 200) && return
|
20
|
+
end
|
21
|
+
render json: 'You are not authorize to complete this action.', status: 422
|
22
|
+
end
|
23
|
+
|
24
|
+
def notifications
|
25
|
+
if MnAuthorizers::UserNotificationAuthorizer.readable_by?(current_user, params[:user_id])
|
26
|
+
mobile_or_in_app = (params[:platform] == 'mobile') ? 'mobile'.to_sym : 'in_app'.to_sym
|
27
|
+
@notifications = MetaNotification::Notification.select(:id, 'mn_notifications.*', 'mn_user_notifications.id as mn_user_notification_id', 'mn_user_notifications.user_id', mobile_or_in_app, 'mn_user_notifications.is_read', 'mn_notification_types.name', 'mn_notification_types.icon', 'mn_notification_types.label', 'mn_notifications.created_by_id', 'mn_notifications.created_at')
|
28
|
+
.joins('JOIN mn_user_notifications on mn_user_notifications.notification_id = mn_notifications.id')
|
29
|
+
.joins('JOIN mn_notification_types on mn_notification_types.id = mn_user_notifications.notification_type_id')
|
30
|
+
.where('mn_user_notifications.user_id' => params[:user_id], 'mn_user_notifications.notification_type_id' => @notification_type_in_ids)
|
31
|
+
.where.not('mn_user_notifications.notification_type_id' => @notification_type_not_in_ids)
|
32
|
+
@unread_count = @notifications.select { |n| n.is_read == 0 }.length
|
33
|
+
@notifications = @notifications.where('mn_user_notifications.is_read' => (params[:is_fetch_unread].try(:to_bool).present? ? false : [true, false]))
|
34
|
+
@notifications = @notifications.where('mn_notifications.resource_type' => params[:resource_type], 'mn_notifications.resource_id' => params[:resource_id]) if params[:resource_id].present? && params[:resource_type].present?
|
35
|
+
@notifications = @notifications.order('mn_notifications.created_at DESC')
|
36
|
+
@notifications = @notifications.page(params[:current_page]) if params[:current_page].present?
|
23
37
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
.joins('JOIN mn_notification_types on mn_notification_types.id = mn_user_notifications.notification_type_id')
|
30
|
-
.where("mn_user_notifications.user_id" => params[:user_id], "mn_user_notifications.notification_type_id"=> @notification_type_in_ids)
|
31
|
-
.where.not("mn_user_notifications.notification_type_id"=> @notification_type_not_in_ids)
|
32
|
-
@unread_count = @notifications.select { |n| n.is_read == 0 }.length
|
33
|
-
@notifications = @notifications.where("mn_user_notifications.is_read" => ((params[:is_fetch_unread].try(:to_bool).present?) ? false : [true, false]) )
|
34
|
-
@notifications = @notifications.where("mn_notifications.resource_type"=> params[:resource_type], "mn_notifications.resource_id"=> params[:resource_id]) if params[:resource_id].present? && params[:resource_type].present?
|
35
|
-
@notifications = @notifications.order("mn_notifications.created_at DESC")
|
36
|
-
@notifications = @notifications.page(params[:current_page]) if params[:current_page].present?
|
38
|
+
@created_by_users = User.where(id: @notifications.map(&:created_by_id).compact.uniq)
|
39
|
+
return
|
40
|
+
end
|
41
|
+
render json: 'You are not authorize to complete this action.', status: 422
|
42
|
+
end
|
37
43
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
44
|
+
def mark_all_read
|
45
|
+
@user_notifications = MetaNotification::UserNotification.where(user_id: current_user.id, is_read: false, notification_type_id: @notification_type_in_ids)
|
46
|
+
.where.not(notification_type_id: @notification_type_not_in_ids)
|
47
|
+
@user_notifications.update_all(is_read: true)
|
48
|
+
render(json: { marked: true }, status: 200) && return
|
49
|
+
end
|
43
50
|
|
44
|
-
|
45
|
-
|
46
|
-
.where.not(notification_type_id: @notification_type_not_in_ids)
|
47
|
-
@user_notifications.update_all({is_read: true})
|
48
|
-
render :json => {marked: true}, status: 200 and return
|
49
|
-
end
|
51
|
+
def destroy
|
52
|
+
end
|
50
53
|
|
51
|
-
|
52
|
-
|
54
|
+
def unread_count
|
55
|
+
mobile_or_in_app = (params[:platform] == 'mobile') ? 'mobile'.to_sym : 'in_app'.to_sym
|
56
|
+
unread_count = MetaNotification::Notification.select(:id, 'mn_notifications.*', 'mn_user_notifications.id as mn_user_notification_id', 'mn_user_notifications.user_id', mobile_or_in_app, 'mn_user_notifications.is_read', 'mn_notification_types.name', 'mn_notification_types.icon', 'mn_notification_types.label', 'mn_notifications.created_by_id', 'mn_notifications.created_at')
|
57
|
+
.joins('JOIN mn_user_notifications on mn_user_notifications.notification_id = mn_notifications.id')
|
58
|
+
.joins('JOIN mn_notification_types on mn_notification_types.id = mn_user_notifications.notification_type_id')
|
59
|
+
.where('mn_user_notifications.user_id' => params[:user_id], 'mn_user_notifications.notification_type_id' => @notification_type_in_ids, 'mn_user_notifications.is_read' => false)
|
60
|
+
.where.not('mn_user_notifications.notification_type_id' => @notification_type_not_in_ids).length
|
61
|
+
render(json: { unread_count: unread_count }, status: 200) && return
|
62
|
+
end
|
53
63
|
|
54
|
-
|
55
|
-
|
56
|
-
|
64
|
+
def set_user_notification
|
65
|
+
@user_notification = UserNotification.find params[:id]
|
66
|
+
end
|
57
67
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
68
|
+
def set_notification_type_ids_for_filter
|
69
|
+
@notification_type_not_in_ids = params[:notification_type_not_in].present? ? MetaNotification::NotificationType.where(name: params[:notification_type_not_in]).pluck(:id) : nil
|
70
|
+
@notification_type_in_ids = params[:notification_type_in].present? ? MetaNotification::NotificationType.where(name: params[:notification_type_in]).pluck(:id) : MetaNotification::NotificationType.all.pluck(:id)
|
71
|
+
end
|
62
72
|
|
63
|
-
|
64
|
-
|
65
|
-
|
73
|
+
def user_notification_params
|
74
|
+
params.permit(:is_read)
|
75
|
+
end
|
66
76
|
|
67
|
-
|
68
|
-
|
69
|
-
|
77
|
+
def init_authorizer
|
78
|
+
@user_notifications_authorizer = MnAuthorizers::UserNotificationAuthorizer.new
|
79
|
+
end
|
70
80
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
81
|
+
private :set_user_notification, :user_notification_params, :init_authorizer, :set_notification_type_ids_for_filter
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
75
85
|
end
|
@@ -1,41 +1,148 @@
|
|
1
|
-
[1m[36m (
|
2
|
-
[1m[35m (
|
3
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.
|
4
|
-
Migrating to CreateMetaNotificationNotificationTypes (
|
5
|
-
[1m[35m (
|
1
|
+
[1m[36m (163.6ms)[0m [1mCREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB[0m
|
2
|
+
[1m[35m (290.6ms)[0m CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
|
3
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT `schema_migrations`.* FROM `schema_migrations`[0m
|
4
|
+
Migrating to CreateMetaNotificationNotificationTypes (20160620071720)
|
5
|
+
[1m[35m (84.8ms)[0m CREATE TABLE `mn_notification_types` (`id` int(11) auto_increment PRIMARY KEY, `name` varchar(255) NOT NULL, `display_name` varchar(255), `created_by_id` int(11) NOT NULL, `updated_by_id` int(11) NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
|
6
|
+
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
7
|
+
[1m[35mSQL (1.4ms)[0m INSERT INTO `schema_migrations` (`version`) VALUES ('20160620071720')
|
8
|
+
[1m[36m (89.7ms)[0m [1mCOMMIT[0m
|
9
|
+
Migrating to CreateMetaNotificationNotificationTemplates (20160620071721)
|
10
|
+
[1m[35m (82.3ms)[0m CREATE TABLE `mn_notification_templates` (`id` int(11) auto_increment PRIMARY KEY, `notification_type_id` int(11) NOT NULL, `in_app` varchar(255), `mobile` varchar(255), `push` varchar(255), `email` text, `sms` varchar(255), `email_subject` varchar(255), `resource_id` int(11), `resource_type` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
|
11
|
+
[1m[36m (174.0ms)[0m [1mCREATE UNIQUE INDEX `unique_type_resource_index` ON `mn_notification_templates` (`notification_type_id`, `resource_type`, `resource_id`) [0m
|
12
|
+
[1m[35m (159.0ms)[0m CREATE INDEX `resource_index` ON `mn_notification_templates` (`resource_type`, `resource_id`)
|
6
13
|
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
7
|
-
[1m[35mSQL (0.
|
8
|
-
[1m[36m (
|
9
|
-
Migrating to
|
10
|
-
[1m[35m (
|
11
|
-
[1m[36m (
|
12
|
-
[1m[
|
13
|
-
[1m[
|
14
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO `schema_migrations` (`version`) VALUES ('20160620071721')
|
15
|
+
[1m[36m (106.3ms)[0m [1mCOMMIT[0m
|
16
|
+
Migrating to CreateMetaNotificationNotifications (20160620071722)
|
17
|
+
[1m[35m (89.4ms)[0m CREATE TABLE `mn_notifications` (`id` int(11) auto_increment PRIMARY KEY, `notification_template_id` int(11) NOT NULL, `in_app` text NOT NULL, `mobile` text NOT NULL, `resource_type` varchar(255), `resource_id` int(11), `created_by_id` int(11) NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, INDEX `index_mn_notifications_on_notification_template_id` (`notification_template_id`) , INDEX `index_mn_notifications_on_created_by_id` (`created_by_id`) ) ENGINE=InnoDB
|
18
|
+
[1m[36m (0.3ms)[0m [1mBEGIN[0m
|
19
|
+
[1m[35mSQL (0.5ms)[0m INSERT INTO `schema_migrations` (`version`) VALUES ('20160620071722')
|
20
|
+
[1m[36m (46.5ms)[0m [1mCOMMIT[0m
|
21
|
+
Migrating to CreateMetaNotificationUserNotifications (20160620071723)
|
22
|
+
[1m[35m (81.0ms)[0m CREATE TABLE `mn_user_notifications` (`id` int(11) auto_increment PRIMARY KEY, `user_id` int(11) NOT NULL, `notification_id` int(11) NOT NULL, `is_read` tinyint(1) NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, INDEX `index_mn_user_notifications_on_user_id` (`user_id`) , INDEX `index_mn_user_notifications_on_notification_id` (`notification_id`) ) ENGINE=InnoDB
|
23
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
24
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO `schema_migrations` (`version`) VALUES ('20160620071723')
|
25
|
+
[1m[36m (48.3ms)[0m [1mCOMMIT[0m
|
26
|
+
Migrating to CreateMetaNotificationNotificationSettings (20160620071724)
|
27
|
+
[1m[35m (89.4ms)[0m CREATE TABLE `mn_notification_settings` (`id` int(11) auto_increment PRIMARY KEY, `notification_type_id` int(11) NOT NULL, `is_mute` tinyint(1) DEFAULT 0 NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
|
28
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
29
|
+
[1m[35mSQL (0.5ms)[0m INSERT INTO `schema_migrations` (`version`) VALUES ('20160620071724')
|
30
|
+
[1m[36m (46.9ms)[0m [1mCOMMIT[0m
|
31
|
+
Migrating to CreateMetaNotificationUserNotificationSettings (20160620071725)
|
32
|
+
[1m[35m (81.6ms)[0m CREATE TABLE `mn_user_notification_settings` (`id` int(11) auto_increment PRIMARY KEY, `user_id` int(11) NOT NULL, `notification_type_id` int(11) NOT NULL, `is_mute` tinyint(1) DEFAULT 0 NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, INDEX `index_mn_user_notification_settings_on_notification_type_id` (`notification_type_id`) ) ENGINE=InnoDB
|
33
|
+
[1m[36m (165.9ms)[0m [1mCREATE UNIQUE INDEX `unique_user_notification_type_index` ON `mn_user_notification_settings` (`user_id`, `notification_type_id`) [0m
|
34
|
+
[1m[35m (0.2ms)[0m BEGIN
|
35
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20160620071725')[0m
|
36
|
+
[1m[35m (55.8ms)[0m COMMIT
|
37
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT `schema_migrations`.* FROM `schema_migrations`[0m
|
38
|
+
[1m[35m (0.3ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
39
|
+
,fk.referenced_column_name as 'primary_key'
|
40
|
+
,fk.column_name as 'column'
|
41
|
+
,fk.constraint_name as 'name'
|
42
|
+
FROM information_schema.key_column_usage fk
|
43
|
+
WHERE fk.referenced_column_name is not null
|
44
|
+
AND fk.table_schema = 'dummy_development'
|
45
|
+
AND fk.table_name = 'mn_notification_settings'
|
46
|
+
|
47
|
+
[1m[36m (0.1ms)[0m [1mSHOW CREATE TABLE `mn_notification_settings`[0m
|
48
|
+
[1m[35m (0.3ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
49
|
+
,fk.referenced_column_name as 'primary_key'
|
50
|
+
,fk.column_name as 'column'
|
51
|
+
,fk.constraint_name as 'name'
|
52
|
+
FROM information_schema.key_column_usage fk
|
53
|
+
WHERE fk.referenced_column_name is not null
|
54
|
+
AND fk.table_schema = 'dummy_development'
|
55
|
+
AND fk.table_name = 'mn_notification_templates'
|
56
|
+
|
57
|
+
[1m[36m (0.2ms)[0m [1mSHOW CREATE TABLE `mn_notification_templates`[0m
|
58
|
+
[1m[35m (0.3ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
59
|
+
,fk.referenced_column_name as 'primary_key'
|
60
|
+
,fk.column_name as 'column'
|
61
|
+
,fk.constraint_name as 'name'
|
62
|
+
FROM information_schema.key_column_usage fk
|
63
|
+
WHERE fk.referenced_column_name is not null
|
64
|
+
AND fk.table_schema = 'dummy_development'
|
65
|
+
AND fk.table_name = 'mn_notification_types'
|
66
|
+
|
67
|
+
[1m[36m (0.1ms)[0m [1mSHOW CREATE TABLE `mn_notification_types`[0m
|
68
|
+
[1m[35m (0.3ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
69
|
+
,fk.referenced_column_name as 'primary_key'
|
70
|
+
,fk.column_name as 'column'
|
71
|
+
,fk.constraint_name as 'name'
|
72
|
+
FROM information_schema.key_column_usage fk
|
73
|
+
WHERE fk.referenced_column_name is not null
|
74
|
+
AND fk.table_schema = 'dummy_development'
|
75
|
+
AND fk.table_name = 'mn_notifications'
|
76
|
+
|
77
|
+
[1m[36m (0.1ms)[0m [1mSHOW CREATE TABLE `mn_notifications`[0m
|
78
|
+
[1m[35m (0.3ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
79
|
+
,fk.referenced_column_name as 'primary_key'
|
80
|
+
,fk.column_name as 'column'
|
81
|
+
,fk.constraint_name as 'name'
|
82
|
+
FROM information_schema.key_column_usage fk
|
83
|
+
WHERE fk.referenced_column_name is not null
|
84
|
+
AND fk.table_schema = 'dummy_development'
|
85
|
+
AND fk.table_name = 'mn_user_notification_settings'
|
86
|
+
|
87
|
+
[1m[36m (0.1ms)[0m [1mSHOW CREATE TABLE `mn_user_notification_settings`[0m
|
88
|
+
[1m[35m (0.2ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
89
|
+
,fk.referenced_column_name as 'primary_key'
|
90
|
+
,fk.column_name as 'column'
|
91
|
+
,fk.constraint_name as 'name'
|
92
|
+
FROM information_schema.key_column_usage fk
|
93
|
+
WHERE fk.referenced_column_name is not null
|
94
|
+
AND fk.table_schema = 'dummy_development'
|
95
|
+
AND fk.table_name = 'mn_user_notifications'
|
96
|
+
|
97
|
+
[1m[36m (0.1ms)[0m [1mSHOW CREATE TABLE `mn_user_notifications`[0m
|
98
|
+
[1m[36m (93.6ms)[0m [1mCREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB[0m
|
99
|
+
[1m[35m (199.2ms)[0m CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
|
100
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT `schema_migrations`.* FROM `schema_migrations`[0m
|
14
101
|
Migrating to CreateMetaNotificationNotificationTypes (20160615074820)
|
15
|
-
[1m[35m (
|
102
|
+
[1m[35m (85.4ms)[0m CREATE TABLE `mn_notification_types` (`id` int(11) auto_increment PRIMARY KEY, `name` varchar(255) NOT NULL, `display_name` varchar(255), `created_by_id` int(11) NOT NULL, `updated_by_id` int(11) NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
|
16
103
|
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
17
104
|
[1m[35mSQL (0.2ms)[0m INSERT INTO `schema_migrations` (`version`) VALUES ('20160615074820')
|
18
|
-
[1m[36m (
|
105
|
+
[1m[36m (52.2ms)[0m [1mCOMMIT[0m
|
19
106
|
Migrating to CreateMetaNotificationNotificationTemplates (20160618094218)
|
20
|
-
[1m[35m (
|
21
|
-
[1m[36m (
|
22
|
-
[1m[
|
23
|
-
[1m[35m (12.5ms)[0m CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
|
24
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT `schema_migrations`.* FROM `schema_migrations`[0m
|
25
|
-
Migrating to CreateMetaNotificationNotificationTypes (20160615074820)
|
26
|
-
[1m[35m (4.0ms)[0m CREATE TABLE `mn_notification_types` (`id` int(11) auto_increment PRIMARY KEY, `name` varchar(255) NOT NULL, `display_name` varchar(255), `created_by_id` int(11) NOT NULL, `updated_by_id` int(11) NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
|
107
|
+
[1m[35m (82.0ms)[0m CREATE TABLE `mn_notification_templates` (`id` int(11) auto_increment PRIMARY KEY, `notification_type_id` int(11) NOT NULL, `in_app` varchar(255), `mobile` varchar(255), `push` varchar(255), `email` text, `sms` varchar(255), `email_subject` varchar(255), `resource_id` int(11), `resource_type` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
|
108
|
+
[1m[36m (157.2ms)[0m [1mCREATE UNIQUE INDEX `unique_type_resource_index` ON `mn_notification_templates` (`notification_type_id`, `resource_type`, `resource_id`) [0m
|
109
|
+
[1m[35m (167.0ms)[0m CREATE INDEX `resource_index` ON `mn_notification_templates` (`resource_type`, `resource_id`)
|
27
110
|
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
28
|
-
[1m[35mSQL (0.
|
29
|
-
[1m[36m (
|
30
|
-
Migrating to
|
31
|
-
[1m[35m (
|
32
|
-
[1m[36m (10.4ms)[0m [1mCREATE UNIQUE INDEX `unique_type_resource_index` ON `mn_notification_templates` (`notification_type_id`, `resource_type`, `resource_id`) [0m
|
33
|
-
[1m[35m (10.9ms)[0m CREATE INDEX `resource_index` ON `mn_notification_templates` (`resource_type`, `resource_id`)
|
111
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO `schema_migrations` (`version`) VALUES ('20160618094218')
|
112
|
+
[1m[36m (47.9ms)[0m [1mCOMMIT[0m
|
113
|
+
Migrating to CreateMetaNotificationNotifications (20160619133533)
|
114
|
+
[1m[35m (81.1ms)[0m CREATE TABLE `mn_notifications` (`id` int(11) auto_increment PRIMARY KEY, `notification_template_id` int(11) NOT NULL, `in_app` text NOT NULL, `mobile` text NOT NULL, `resource_type` varchar(255), `resource_id` int(11), `created_by_id` int(11) NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, INDEX `index_mn_notifications_on_notification_template_id` (`notification_template_id`) , INDEX `index_mn_notifications_on_created_by_id` (`created_by_id`) ) ENGINE=InnoDB
|
34
115
|
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
35
|
-
[1m[35mSQL (0.2ms)[0m INSERT INTO `schema_migrations` (`version`) VALUES ('
|
36
|
-
[1m[36m (
|
37
|
-
|
38
|
-
[1m[
|
116
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO `schema_migrations` (`version`) VALUES ('20160619133533')
|
117
|
+
[1m[36m (48.2ms)[0m [1mCOMMIT[0m
|
118
|
+
Migrating to CreateMetaNotificationUserNotifications (20160620015754)
|
119
|
+
[1m[35m (80.5ms)[0m CREATE TABLE `mn_user_notifications` (`id` int(11) auto_increment PRIMARY KEY, `user_id` int(11) NOT NULL, `notification_id` int(11) NOT NULL, `notification_type_id` int(11) NOT NULL, `is_read` tinyint(1) NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, INDEX `index_mn_user_notifications_on_user_id` (`user_id`) , INDEX `index_mn_user_notifications_on_notification_id` (`notification_id`) , INDEX `index_mn_user_notifications_on_notification_type_id` (`notification_type_id`) ) ENGINE=InnoDB
|
120
|
+
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
121
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO `schema_migrations` (`version`) VALUES ('20160620015754')
|
122
|
+
[1m[36m (47.9ms)[0m [1mCOMMIT[0m
|
123
|
+
Migrating to CreateMetaNotificationNotificationSettings (20160620020944)
|
124
|
+
[1m[35m (82.1ms)[0m CREATE TABLE `mn_notification_settings` (`id` int(11) auto_increment PRIMARY KEY, `notification_type_id` int(11) NOT NULL, `is_mute` tinyint(1) DEFAULT 0 NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
|
125
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
126
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO `schema_migrations` (`version`) VALUES ('20160620020944')
|
127
|
+
[1m[36m (48.2ms)[0m [1mCOMMIT[0m
|
128
|
+
Migrating to CreateMetaNotificationUserNotificationSettings (20160620052742)
|
129
|
+
[1m[35m (81.7ms)[0m CREATE TABLE `mn_user_notification_settings` (`id` int(11) auto_increment PRIMARY KEY, `user_id` int(11) NOT NULL, `notification_type_id` int(11) NOT NULL, `is_mute` tinyint(1) DEFAULT 0 NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, INDEX `index_mn_user_notification_settings_on_notification_type_id` (`notification_type_id`) ) ENGINE=InnoDB
|
130
|
+
[1m[36m (140.9ms)[0m [1mCREATE UNIQUE INDEX `unique_user_notification_type_index` ON `mn_user_notification_settings` (`user_id`, `notification_type_id`) [0m
|
131
|
+
[1m[35m (0.1ms)[0m BEGIN
|
132
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20160620052742')[0m
|
133
|
+
[1m[35m (48.4ms)[0m COMMIT
|
134
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT `schema_migrations`.* FROM `schema_migrations`[0m
|
135
|
+
[1m[35m (0.4ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
136
|
+
,fk.referenced_column_name as 'primary_key'
|
137
|
+
,fk.column_name as 'column'
|
138
|
+
,fk.constraint_name as 'name'
|
139
|
+
FROM information_schema.key_column_usage fk
|
140
|
+
WHERE fk.referenced_column_name is not null
|
141
|
+
AND fk.table_schema = 'dummy_development'
|
142
|
+
AND fk.table_name = 'mn_notification_settings'
|
143
|
+
|
144
|
+
[1m[36m (0.2ms)[0m [1mSHOW CREATE TABLE `mn_notification_settings`[0m
|
145
|
+
[1m[35m (0.3ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
39
146
|
,fk.referenced_column_name as 'primary_key'
|
40
147
|
,fk.column_name as 'column'
|
41
148
|
,fk.constraint_name as 'name'
|
@@ -43,9 +150,9 @@ FROM information_schema.key_column_usage fk
|
|
43
150
|
WHERE fk.referenced_column_name is not null
|
44
151
|
AND fk.table_schema = 'dummy_development'
|
45
152
|
AND fk.table_name = 'mn_notification_templates'
|
46
|
-
|
47
|
-
[1m[
|
48
|
-
[1m[
|
153
|
+
|
154
|
+
[1m[36m (0.2ms)[0m [1mSHOW CREATE TABLE `mn_notification_templates`[0m
|
155
|
+
[1m[35m (0.3ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
49
156
|
,fk.referenced_column_name as 'primary_key'
|
50
157
|
,fk.column_name as 'column'
|
51
158
|
,fk.constraint_name as 'name'
|
@@ -53,5 +160,105 @@ FROM information_schema.key_column_usage fk
|
|
53
160
|
WHERE fk.referenced_column_name is not null
|
54
161
|
AND fk.table_schema = 'dummy_development'
|
55
162
|
AND fk.table_name = 'mn_notification_types'
|
56
|
-
|
57
|
-
[1m[
|
163
|
+
|
164
|
+
[1m[36m (0.2ms)[0m [1mSHOW CREATE TABLE `mn_notification_types`[0m
|
165
|
+
[1m[35m (0.3ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
166
|
+
,fk.referenced_column_name as 'primary_key'
|
167
|
+
,fk.column_name as 'column'
|
168
|
+
,fk.constraint_name as 'name'
|
169
|
+
FROM information_schema.key_column_usage fk
|
170
|
+
WHERE fk.referenced_column_name is not null
|
171
|
+
AND fk.table_schema = 'dummy_development'
|
172
|
+
AND fk.table_name = 'mn_notifications'
|
173
|
+
|
174
|
+
[1m[36m (0.2ms)[0m [1mSHOW CREATE TABLE `mn_notifications`[0m
|
175
|
+
[1m[35m (0.3ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
176
|
+
,fk.referenced_column_name as 'primary_key'
|
177
|
+
,fk.column_name as 'column'
|
178
|
+
,fk.constraint_name as 'name'
|
179
|
+
FROM information_schema.key_column_usage fk
|
180
|
+
WHERE fk.referenced_column_name is not null
|
181
|
+
AND fk.table_schema = 'dummy_development'
|
182
|
+
AND fk.table_name = 'mn_user_notification_settings'
|
183
|
+
|
184
|
+
[1m[36m (0.2ms)[0m [1mSHOW CREATE TABLE `mn_user_notification_settings`[0m
|
185
|
+
[1m[35m (0.3ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
186
|
+
,fk.referenced_column_name as 'primary_key'
|
187
|
+
,fk.column_name as 'column'
|
188
|
+
,fk.constraint_name as 'name'
|
189
|
+
FROM information_schema.key_column_usage fk
|
190
|
+
WHERE fk.referenced_column_name is not null
|
191
|
+
AND fk.table_schema = 'dummy_development'
|
192
|
+
AND fk.table_name = 'mn_user_notifications'
|
193
|
+
|
194
|
+
[1m[36m (0.2ms)[0m [1mSHOW CREATE TABLE `mn_user_notifications`[0m
|
195
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT `schema_migrations`.* FROM `schema_migrations`[0m
|
196
|
+
Migrating to AddAttachmentAttachmentToNotifications (20160727124414)
|
197
|
+
[1m[35m (583.4ms)[0m ALTER TABLE `mn_notifications` ADD `attachment_file_name` varchar(255)
|
198
|
+
[1m[36m (274.9ms)[0m [1mALTER TABLE `mn_notifications` ADD `attachment_content_type` varchar(255)[0m
|
199
|
+
[1m[35m (266.6ms)[0m ALTER TABLE `mn_notifications` ADD `attachment_file_size` int(11)
|
200
|
+
[1m[36m (250.0ms)[0m [1mALTER TABLE `mn_notifications` ADD `attachment_updated_at` datetime[0m
|
201
|
+
[1m[35m (0.1ms)[0m BEGIN
|
202
|
+
[1m[36mSQL (24.6ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20160727124414')[0m
|
203
|
+
[1m[35m (50.3ms)[0m COMMIT
|
204
|
+
[1m[36mActiveRecord::SchemaMigration Load (21.9ms)[0m [1mSELECT `schema_migrations`.* FROM `schema_migrations`[0m
|
205
|
+
[1m[35m (1.6ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
206
|
+
,fk.referenced_column_name as 'primary_key'
|
207
|
+
,fk.column_name as 'column'
|
208
|
+
,fk.constraint_name as 'name'
|
209
|
+
FROM information_schema.key_column_usage fk
|
210
|
+
WHERE fk.referenced_column_name is not null
|
211
|
+
AND fk.table_schema = 'dummy_development'
|
212
|
+
AND fk.table_name = 'mn_notification_settings'
|
213
|
+
|
214
|
+
[1m[36m (0.2ms)[0m [1mSHOW CREATE TABLE `mn_notification_settings`[0m
|
215
|
+
[1m[35m (0.3ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
216
|
+
,fk.referenced_column_name as 'primary_key'
|
217
|
+
,fk.column_name as 'column'
|
218
|
+
,fk.constraint_name as 'name'
|
219
|
+
FROM information_schema.key_column_usage fk
|
220
|
+
WHERE fk.referenced_column_name is not null
|
221
|
+
AND fk.table_schema = 'dummy_development'
|
222
|
+
AND fk.table_name = 'mn_notification_templates'
|
223
|
+
|
224
|
+
[1m[36m (0.1ms)[0m [1mSHOW CREATE TABLE `mn_notification_templates`[0m
|
225
|
+
[1m[35m (0.2ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
226
|
+
,fk.referenced_column_name as 'primary_key'
|
227
|
+
,fk.column_name as 'column'
|
228
|
+
,fk.constraint_name as 'name'
|
229
|
+
FROM information_schema.key_column_usage fk
|
230
|
+
WHERE fk.referenced_column_name is not null
|
231
|
+
AND fk.table_schema = 'dummy_development'
|
232
|
+
AND fk.table_name = 'mn_notification_types'
|
233
|
+
|
234
|
+
[1m[36m (0.1ms)[0m [1mSHOW CREATE TABLE `mn_notification_types`[0m
|
235
|
+
[1m[35m (0.6ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
236
|
+
,fk.referenced_column_name as 'primary_key'
|
237
|
+
,fk.column_name as 'column'
|
238
|
+
,fk.constraint_name as 'name'
|
239
|
+
FROM information_schema.key_column_usage fk
|
240
|
+
WHERE fk.referenced_column_name is not null
|
241
|
+
AND fk.table_schema = 'dummy_development'
|
242
|
+
AND fk.table_name = 'mn_notifications'
|
243
|
+
|
244
|
+
[1m[36m (0.1ms)[0m [1mSHOW CREATE TABLE `mn_notifications`[0m
|
245
|
+
[1m[35m (0.2ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
246
|
+
,fk.referenced_column_name as 'primary_key'
|
247
|
+
,fk.column_name as 'column'
|
248
|
+
,fk.constraint_name as 'name'
|
249
|
+
FROM information_schema.key_column_usage fk
|
250
|
+
WHERE fk.referenced_column_name is not null
|
251
|
+
AND fk.table_schema = 'dummy_development'
|
252
|
+
AND fk.table_name = 'mn_user_notification_settings'
|
253
|
+
|
254
|
+
[1m[36m (0.1ms)[0m [1mSHOW CREATE TABLE `mn_user_notification_settings`[0m
|
255
|
+
[1m[35m (0.3ms)[0m SELECT fk.referenced_table_name as 'to_table'
|
256
|
+
,fk.referenced_column_name as 'primary_key'
|
257
|
+
,fk.column_name as 'column'
|
258
|
+
,fk.constraint_name as 'name'
|
259
|
+
FROM information_schema.key_column_usage fk
|
260
|
+
WHERE fk.referenced_column_name is not null
|
261
|
+
AND fk.table_schema = 'dummy_development'
|
262
|
+
AND fk.table_name = 'mn_user_notifications'
|
263
|
+
|
264
|
+
[1m[36m (0.1ms)[0m [1mSHOW CREATE TABLE `mn_user_notifications`[0m
|