rails-push-notifications 0.2.0
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +150 -0
- data/Rakefile +8 -0
- data/lib/generators/rails-push-notifications/USAGE +6 -0
- data/lib/generators/rails-push-notifications/migrations_generator.rb +29 -0
- data/lib/generators/rails-push-notifications/templates/migrations/create_rails_push_notifications_apps.rb +23 -0
- data/lib/generators/rails-push-notifications/templates/migrations/create_rails_push_notifications_notifications.rb +22 -0
- data/lib/rails-push-notifications.rb +4 -0
- data/lib/rails-push-notifications/apps.rb +4 -0
- data/lib/rails-push-notifications/apps/apns_app.rb +24 -0
- data/lib/rails-push-notifications/apps/base_app.rb +26 -0
- data/lib/rails-push-notifications/apps/gcm_app.rb +17 -0
- data/lib/rails-push-notifications/apps/mpns_app.rb +17 -0
- data/lib/rails-push-notifications/notification.rb +29 -0
- data/lib/rails-push-notifications/rails_push_notifications_railtie.rb +7 -0
- data/lib/rails-push-notifications/version.rb +3 -0
- data/spec/apps/apns_app_spec.rb +96 -0
- data/spec/apps/gcm_app_spec.rb +69 -0
- data/spec/apps/mpns_app_spec.rb +75 -0
- data/spec/factories/apps.rb +15 -0
- data/spec/factories/notifications.rb +20 -0
- data/spec/generators/migrations_generator_spec.rb +25 -0
- data/spec/log/test.log +262 -0
- data/spec/notification_spec.rb +96 -0
- data/spec/rails_apps/rails4.rb +47 -0
- data/spec/spec_helper.rb +45 -0
- data/spec/support/factory_girl.rb +5 -0
- metadata +196 -0
@@ -0,0 +1,69 @@
|
|
1
|
+
module RailsPushNotifications
|
2
|
+
describe GCMApp, type: :model do
|
3
|
+
|
4
|
+
it 'creates an instance given valid attributes' do
|
5
|
+
GCMApp.create! attributes_for :gcm_app
|
6
|
+
end
|
7
|
+
|
8
|
+
describe 'validations' do
|
9
|
+
let(:app) { build :gcm_app }
|
10
|
+
|
11
|
+
it 'requires a gcm key' do
|
12
|
+
app.gcm_key = nil
|
13
|
+
expect(app).to_not be_valid
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'notifications relationship' do
|
18
|
+
let(:app) { create :gcm_app }
|
19
|
+
|
20
|
+
it 'can create new notifications' do
|
21
|
+
expect do
|
22
|
+
app.notifications.create attributes_for :gcm_notification
|
23
|
+
end.to change { app.reload.notifications.count }.from(0).to 1
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#push_notifications' do
|
28
|
+
let(:app) { create :gcm_app }
|
29
|
+
let(:notifications) do
|
30
|
+
(1..10).map { create :gcm_notification, app: app }
|
31
|
+
end
|
32
|
+
let(:single_notification) { create :gcm_notification, app: app }
|
33
|
+
|
34
|
+
let(:response) { JSON.dump a: 1 }
|
35
|
+
|
36
|
+
before do
|
37
|
+
stub_request(:post, 'https://android.googleapis.com/gcm/send').
|
38
|
+
to_return status: [200, 'OK'], body: response
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'assigns results' do
|
42
|
+
expect do
|
43
|
+
app.push_notifications
|
44
|
+
end.to change {
|
45
|
+
notifications.map { |n| n.reload.results }
|
46
|
+
}.from([nil] * 10).
|
47
|
+
to([RubyPushNotifications::GCM::GCMResponse.new(200, response)] * 10)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'marks as sent' do
|
51
|
+
expect do
|
52
|
+
app.push_notifications
|
53
|
+
end.to change { single_notification.reload.sent }.from(false).to true
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'with an already sent notification' do
|
57
|
+
let!(:sent_notification) { create :apns_notification, app: app }
|
58
|
+
|
59
|
+
before { app.push_notifications }
|
60
|
+
|
61
|
+
it "doesn't send already sent notifications" do
|
62
|
+
expect(RubyPushNotifications::GCM::GCMConnection).
|
63
|
+
to_not receive(:post)
|
64
|
+
app.push_notifications
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module RailsPushNotifications
|
2
|
+
describe MPNSApp, type: :model do
|
3
|
+
|
4
|
+
it 'creates an instance given valid attributes' do
|
5
|
+
MPNSApp.create! attributes_for :mpns_app
|
6
|
+
end
|
7
|
+
|
8
|
+
describe 'validations' do
|
9
|
+
|
10
|
+
let(:app) { build :mpns_app }
|
11
|
+
|
12
|
+
it 'requires the certificate' do
|
13
|
+
app.cert = nil
|
14
|
+
expect(app).to_not be_valid
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'notifications relationship' do
|
19
|
+
|
20
|
+
let(:app) { create :mpns_app }
|
21
|
+
|
22
|
+
it 'can create new notifications' do
|
23
|
+
expect do
|
24
|
+
app.notifications.create attributes_for :mpns_notification
|
25
|
+
end.to change { app.reload.notifications.count }.from(0).to 1
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#push_notifications' do
|
30
|
+
|
31
|
+
let(:app) { create :mpns_app }
|
32
|
+
let(:notifications) {
|
33
|
+
(1..10).map { create :mpns_notification, app: app }
|
34
|
+
}
|
35
|
+
let(:single_notification) { create :mpns_notification, app: app }
|
36
|
+
|
37
|
+
let(:headers) {
|
38
|
+
{
|
39
|
+
'x-notificationstatus' => 'Received',
|
40
|
+
'x-deviceconnectionstatus' => 'Connected',
|
41
|
+
'x-subscriptionstatus' => 'Active'
|
42
|
+
}
|
43
|
+
}
|
44
|
+
let(:response) { [ { device_url: 'http://s.notify.live.net/1', headers: headers, code: 200 } ]}
|
45
|
+
|
46
|
+
before do
|
47
|
+
stub_request(:post, %r{s.notify.live.net}).
|
48
|
+
to_return status: [200, 'OK'], headers: headers
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'assigns results' do
|
52
|
+
expect do
|
53
|
+
app.push_notifications
|
54
|
+
end.to change { notifications.map { |n| n.reload.results } }.from([nil] * 10).to([RubyPushNotifications::MPNS::MPNSResponse.new(response)] * 10)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'marks as sent' do
|
58
|
+
expect do
|
59
|
+
app.push_notifications
|
60
|
+
end.to change { single_notification.reload.sent }.from(false).to true
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'with an already sent notification' do
|
64
|
+
let!(:sent_notification) { create :mpns_notification, app: app }
|
65
|
+
|
66
|
+
before { app.push_notifications }
|
67
|
+
|
68
|
+
it "doesn't send already sent notifications" do
|
69
|
+
expect(RubyPushNotifications::MPNS::MPNSConnection).to_not receive(:post)
|
70
|
+
app.push_notifications
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :apns_app, class: 'RailsPushNotifications::APNSApp' do
|
3
|
+
apns_dev_cert 'abc'
|
4
|
+
apns_prod_cert 'def'
|
5
|
+
sandbox_mode true
|
6
|
+
end
|
7
|
+
|
8
|
+
factory :gcm_app, class: 'RailsPushNotifications::GCMApp' do
|
9
|
+
gcm_key 'abc123def456'
|
10
|
+
end
|
11
|
+
|
12
|
+
factory :mpns_app, class: 'RailsPushNotifications::MPNSApp' do
|
13
|
+
cert 'abc'
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
FactoryGirl.define do
|
3
|
+
factory :apns_notification, class: 'RailsPushNotifications::Notification' do
|
4
|
+
association :app, factory: :apns_app, strategy: :create
|
5
|
+
data a: 1
|
6
|
+
destinations ['1']
|
7
|
+
end
|
8
|
+
|
9
|
+
factory :gcm_notification, class: 'RailsPushNotifications::Notification' do
|
10
|
+
association :app, factory: :gcm_app, strategy: :create
|
11
|
+
data a: 1
|
12
|
+
destinations ['1']
|
13
|
+
end
|
14
|
+
|
15
|
+
factory :mpns_notification, class: 'RailsPushNotifications::Notification' do
|
16
|
+
association :app, factory: :mpns_app, strategy: :create
|
17
|
+
data message: { value1: 'hello' }
|
18
|
+
destinations ['http://s.notify.live.net/1']
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'generators/rails-push-notifications/migrations_generator'
|
2
|
+
|
3
|
+
describe RailsPushNotifications::Generators::MigrationsGenerator, type: :generator do
|
4
|
+
destination File.expand_path("../tmp", __FILE__)
|
5
|
+
|
6
|
+
before do
|
7
|
+
prepare_destination
|
8
|
+
run_generator
|
9
|
+
end
|
10
|
+
|
11
|
+
after do
|
12
|
+
rm_rf destination_root
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'creates the migrations' do
|
16
|
+
expect(destination_root).to have_structure do
|
17
|
+
directory 'db' do
|
18
|
+
directory 'migrate' do
|
19
|
+
migration 'create_rails_push_notifications_apps'
|
20
|
+
migration 'create_rails_push_notifications_notifications'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/spec/log/test.log
ADDED
@@ -0,0 +1,262 @@
|
|
1
|
+
[1m[36m (0.2ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
2
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3
|
+
[1m[36m (0.1ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
4
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.0ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
5
|
+
Migrating to CreateRailsPushNotificationsApps (0)
|
6
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
7
|
+
[1m[35m (0.2ms)[0m CREATE TABLE "rails_push_notifications_apns_apps" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "apns_dev_cert" text, "apns_prod_cert" text, "sandbox_mode" boolean, "created_at" datetime, "updated_at" datetime)
|
8
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "0"]]
|
9
|
+
[1m[35m (0.1ms)[0m commit transaction
|
10
|
+
Migrating to CreateRpnDevices (1)
|
11
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
12
|
+
[1m[35m (0.2ms)[0m CREATE TABLE "rpn_devices" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "guid" varchar, "config_id" integer, "config_type" varchar, "created_at" datetime, "updated_at" datetime)
|
13
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_rpn_devices_on_config_id_and_config_type" ON "rpn_devices" ("config_id", "config_type")[0m
|
14
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "1"]]
|
15
|
+
[1m[36m (0.0ms)[0m [1mcommit transaction[0m
|
16
|
+
Migrating to CreateRpnNotifications (2)
|
17
|
+
[1m[35m (0.0ms)[0m begin transaction
|
18
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "rpn_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar, "device_token" varchar, "config_id" integer, "config_type" varchar, "data" text, "error" varchar, "sent_at" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
19
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_notifications_on_type" ON "rpn_notifications" ("type")
|
20
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
21
|
+
FROM sqlite_master
|
22
|
+
WHERE name='index_rpn_notifications_on_type' AND type='index'
|
23
|
+
UNION ALL
|
24
|
+
SELECT sql
|
25
|
+
FROM sqlite_temp_master
|
26
|
+
WHERE name='index_rpn_notifications_on_type' AND type='index'
|
27
|
+
[0m
|
28
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_notifications_on_config_id_and_config_type" ON "rpn_notifications" ("config_id", "config_type")
|
29
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "rpn_bulk_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar, "device_tokens" text, "config_id" integer, "config_type" varchar, "data" text, "failed" integer, "succeeded" integer, "sent_at" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
30
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_bulk_notifications_on_type" ON "rpn_bulk_notifications" ("type")
|
31
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
32
|
+
FROM sqlite_master
|
33
|
+
WHERE name='index_rpn_bulk_notifications_on_type' AND type='index'
|
34
|
+
UNION ALL
|
35
|
+
SELECT sql
|
36
|
+
FROM sqlite_temp_master
|
37
|
+
WHERE name='index_rpn_bulk_notifications_on_type' AND type='index'
|
38
|
+
[0m
|
39
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_bulk_notifications_on_config_id_and_config_type" ON "rpn_bulk_notifications" ("config_id", "config_type")
|
40
|
+
[1m[36mSQL (0.0ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "2"]]
|
41
|
+
[1m[35m (0.0ms)[0m commit transaction
|
42
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
43
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
44
|
+
[1m[36m (0.2ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
45
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
46
|
+
[1m[36m (0.1ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
47
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.0ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
48
|
+
Migrating to CreateRailsPushNotificationsApps (0)
|
49
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
50
|
+
[1m[35m (0.2ms)[0m CREATE TABLE "rails_push_notifications_apns_apps" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "apns_dev_cert" text, "apns_prod_cert" text, "sandbox_mode" boolean, "created_at" datetime, "updated_at" datetime)
|
51
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "0"]]
|
52
|
+
[1m[35m (0.1ms)[0m commit transaction
|
53
|
+
Migrating to CreateRpnDevices (1)
|
54
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
55
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "rpn_devices" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "guid" varchar, "config_id" integer, "config_type" varchar, "created_at" datetime, "updated_at" datetime)
|
56
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_rpn_devices_on_config_id_and_config_type" ON "rpn_devices" ("config_id", "config_type")[0m
|
57
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "1"]]
|
58
|
+
[1m[36m (0.0ms)[0m [1mcommit transaction[0m
|
59
|
+
Migrating to CreateRpnNotifications (2)
|
60
|
+
[1m[35m (0.0ms)[0m begin transaction
|
61
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "rpn_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar, "device_token" varchar, "config_id" integer, "config_type" varchar, "data" text, "error" varchar, "sent_at" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
62
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_notifications_on_type" ON "rpn_notifications" ("type")
|
63
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
64
|
+
FROM sqlite_master
|
65
|
+
WHERE name='index_rpn_notifications_on_type' AND type='index'
|
66
|
+
UNION ALL
|
67
|
+
SELECT sql
|
68
|
+
FROM sqlite_temp_master
|
69
|
+
WHERE name='index_rpn_notifications_on_type' AND type='index'
|
70
|
+
[0m
|
71
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_notifications_on_config_id_and_config_type" ON "rpn_notifications" ("config_id", "config_type")
|
72
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "rpn_bulk_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar, "device_tokens" text, "config_id" integer, "config_type" varchar, "data" text, "failed" integer, "succeeded" integer, "sent_at" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
73
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_bulk_notifications_on_type" ON "rpn_bulk_notifications" ("type")
|
74
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
75
|
+
FROM sqlite_master
|
76
|
+
WHERE name='index_rpn_bulk_notifications_on_type' AND type='index'
|
77
|
+
UNION ALL
|
78
|
+
SELECT sql
|
79
|
+
FROM sqlite_temp_master
|
80
|
+
WHERE name='index_rpn_bulk_notifications_on_type' AND type='index'
|
81
|
+
[0m
|
82
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_bulk_notifications_on_config_id_and_config_type" ON "rpn_bulk_notifications" ("config_id", "config_type")
|
83
|
+
[1m[36mSQL (0.0ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "2"]]
|
84
|
+
[1m[35m (0.0ms)[0m commit transaction
|
85
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
86
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
87
|
+
[1m[36m (0.2ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
88
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
89
|
+
[1m[36m (0.1ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
90
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
91
|
+
Migrating to CreateRailsPushNotificationsApps (0)
|
92
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
93
|
+
[1m[35m (0.2ms)[0m CREATE TABLE "rails_push_notifications_apns_apps" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "apns_dev_cert" text, "apns_prod_cert" text, "sandbox_mode" boolean, "created_at" datetime, "updated_at" datetime)
|
94
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "0"]]
|
95
|
+
[1m[35m (0.0ms)[0m commit transaction
|
96
|
+
Migrating to CreateRpnDevices (1)
|
97
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
98
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "rpn_devices" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "guid" varchar, "config_id" integer, "config_type" varchar, "created_at" datetime, "updated_at" datetime)
|
99
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_rpn_devices_on_config_id_and_config_type" ON "rpn_devices" ("config_id", "config_type")[0m
|
100
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "1"]]
|
101
|
+
[1m[36m (0.0ms)[0m [1mcommit transaction[0m
|
102
|
+
Migrating to CreateRpnNotifications (2)
|
103
|
+
[1m[35m (0.0ms)[0m begin transaction
|
104
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "rpn_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar, "device_token" varchar, "config_id" integer, "config_type" varchar, "data" text, "error" varchar, "sent_at" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
105
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_notifications_on_type" ON "rpn_notifications" ("type")
|
106
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
107
|
+
FROM sqlite_master
|
108
|
+
WHERE name='index_rpn_notifications_on_type' AND type='index'
|
109
|
+
UNION ALL
|
110
|
+
SELECT sql
|
111
|
+
FROM sqlite_temp_master
|
112
|
+
WHERE name='index_rpn_notifications_on_type' AND type='index'
|
113
|
+
[0m
|
114
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_notifications_on_config_id_and_config_type" ON "rpn_notifications" ("config_id", "config_type")
|
115
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "rpn_bulk_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar, "device_tokens" text, "config_id" integer, "config_type" varchar, "data" text, "failed" integer, "succeeded" integer, "sent_at" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
116
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_bulk_notifications_on_type" ON "rpn_bulk_notifications" ("type")
|
117
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
118
|
+
FROM sqlite_master
|
119
|
+
WHERE name='index_rpn_bulk_notifications_on_type' AND type='index'
|
120
|
+
UNION ALL
|
121
|
+
SELECT sql
|
122
|
+
FROM sqlite_temp_master
|
123
|
+
WHERE name='index_rpn_bulk_notifications_on_type' AND type='index'
|
124
|
+
[0m
|
125
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_bulk_notifications_on_config_id_and_config_type" ON "rpn_bulk_notifications" ("config_id", "config_type")
|
126
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "2"]]
|
127
|
+
[1m[35m (0.0ms)[0m commit transaction
|
128
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
129
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
130
|
+
[1m[36m (0.2ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
131
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
132
|
+
[1m[36m (0.1ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
133
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.0ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
134
|
+
Migrating to CreateRailsPushNotificationsApps (0)
|
135
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
136
|
+
[1m[35m (0.2ms)[0m CREATE TABLE "rails_push_notifications_apns_apps" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "apns_dev_cert" text, "apns_prod_cert" text, "sandbox_mode" boolean, "created_at" datetime, "updated_at" datetime)
|
137
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "0"]]
|
138
|
+
[1m[35m (0.0ms)[0m commit transaction
|
139
|
+
Migrating to CreateRpnDevices (1)
|
140
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
141
|
+
[1m[35m (0.2ms)[0m CREATE TABLE "rpn_devices" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "guid" varchar, "config_id" integer, "config_type" varchar, "created_at" datetime, "updated_at" datetime)
|
142
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_rpn_devices_on_config_id_and_config_type" ON "rpn_devices" ("config_id", "config_type")[0m
|
143
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "1"]]
|
144
|
+
[1m[36m (0.0ms)[0m [1mcommit transaction[0m
|
145
|
+
Migrating to CreateRpnNotifications (2)
|
146
|
+
[1m[35m (0.0ms)[0m begin transaction
|
147
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "rpn_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar, "device_token" varchar, "config_id" integer, "config_type" varchar, "data" text, "error" varchar, "sent_at" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
148
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_notifications_on_type" ON "rpn_notifications" ("type")
|
149
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
150
|
+
FROM sqlite_master
|
151
|
+
WHERE name='index_rpn_notifications_on_type' AND type='index'
|
152
|
+
UNION ALL
|
153
|
+
SELECT sql
|
154
|
+
FROM sqlite_temp_master
|
155
|
+
WHERE name='index_rpn_notifications_on_type' AND type='index'
|
156
|
+
[0m
|
157
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_notifications_on_config_id_and_config_type" ON "rpn_notifications" ("config_id", "config_type")
|
158
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "rpn_bulk_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar, "device_tokens" text, "config_id" integer, "config_type" varchar, "data" text, "failed" integer, "succeeded" integer, "sent_at" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
159
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_bulk_notifications_on_type" ON "rpn_bulk_notifications" ("type")
|
160
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
161
|
+
FROM sqlite_master
|
162
|
+
WHERE name='index_rpn_bulk_notifications_on_type' AND type='index'
|
163
|
+
UNION ALL
|
164
|
+
SELECT sql
|
165
|
+
FROM sqlite_temp_master
|
166
|
+
WHERE name='index_rpn_bulk_notifications_on_type' AND type='index'
|
167
|
+
[0m
|
168
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_bulk_notifications_on_config_id_and_config_type" ON "rpn_bulk_notifications" ("config_id", "config_type")
|
169
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "2"]]
|
170
|
+
[1m[35m (0.0ms)[0m commit transaction
|
171
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
172
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
173
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
174
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
175
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
176
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
177
|
+
[1m[36m (0.2ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
178
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
179
|
+
[1m[36m (0.1ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
180
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.0ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
181
|
+
Migrating to CreateRailsPushNotificationsApps (0)
|
182
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
183
|
+
[1m[35m (0.2ms)[0m CREATE TABLE "rails_push_notifications_apns_apps" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "apns_dev_cert" text, "apns_prod_cert" text, "sandbox_mode" boolean, "created_at" datetime, "updated_at" datetime)
|
184
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "0"]]
|
185
|
+
[1m[35m (0.0ms)[0m commit transaction
|
186
|
+
Migrating to CreateRpnDevices (1)
|
187
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
188
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "rpn_devices" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "guid" varchar, "config_id" integer, "config_type" varchar, "created_at" datetime, "updated_at" datetime)
|
189
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_rpn_devices_on_config_id_and_config_type" ON "rpn_devices" ("config_id", "config_type")[0m
|
190
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "1"]]
|
191
|
+
[1m[36m (0.0ms)[0m [1mcommit transaction[0m
|
192
|
+
Migrating to CreateRpnNotifications (2)
|
193
|
+
[1m[35m (0.0ms)[0m begin transaction
|
194
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "rpn_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar, "device_token" varchar, "config_id" integer, "config_type" varchar, "data" text, "error" varchar, "sent_at" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
195
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_notifications_on_type" ON "rpn_notifications" ("type")
|
196
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
197
|
+
FROM sqlite_master
|
198
|
+
WHERE name='index_rpn_notifications_on_type' AND type='index'
|
199
|
+
UNION ALL
|
200
|
+
SELECT sql
|
201
|
+
FROM sqlite_temp_master
|
202
|
+
WHERE name='index_rpn_notifications_on_type' AND type='index'
|
203
|
+
[0m
|
204
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_notifications_on_config_id_and_config_type" ON "rpn_notifications" ("config_id", "config_type")
|
205
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "rpn_bulk_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar, "device_tokens" text, "config_id" integer, "config_type" varchar, "data" text, "failed" integer, "succeeded" integer, "sent_at" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
206
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_bulk_notifications_on_type" ON "rpn_bulk_notifications" ("type")
|
207
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
208
|
+
FROM sqlite_master
|
209
|
+
WHERE name='index_rpn_bulk_notifications_on_type' AND type='index'
|
210
|
+
UNION ALL
|
211
|
+
SELECT sql
|
212
|
+
FROM sqlite_temp_master
|
213
|
+
WHERE name='index_rpn_bulk_notifications_on_type' AND type='index'
|
214
|
+
[0m
|
215
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_bulk_notifications_on_config_id_and_config_type" ON "rpn_bulk_notifications" ("config_id", "config_type")
|
216
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "2"]]
|
217
|
+
[1m[35m (0.0ms)[0m commit transaction
|
218
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
219
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
220
|
+
[1m[36m (0.2ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
221
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
222
|
+
[1m[36m (0.1ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
223
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.0ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
224
|
+
Migrating to CreateRailsPushNotificationsApps (0)
|
225
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
226
|
+
[1m[35m (0.2ms)[0m CREATE TABLE "rails_push_notifications_apns_apps" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "apns_dev_cert" text, "apns_prod_cert" text, "sandbox_mode" boolean, "created_at" datetime, "updated_at" datetime)
|
227
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "0"]]
|
228
|
+
[1m[35m (0.0ms)[0m commit transaction
|
229
|
+
Migrating to CreateRpnDevices (1)
|
230
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
231
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "rpn_devices" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "guid" varchar, "config_id" integer, "config_type" varchar, "created_at" datetime, "updated_at" datetime)
|
232
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_rpn_devices_on_config_id_and_config_type" ON "rpn_devices" ("config_id", "config_type")[0m
|
233
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "1"]]
|
234
|
+
[1m[36m (0.0ms)[0m [1mcommit transaction[0m
|
235
|
+
Migrating to CreateRpnNotifications (2)
|
236
|
+
[1m[35m (0.0ms)[0m begin transaction
|
237
|
+
[1m[36m (0.3ms)[0m [1mCREATE TABLE "rpn_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar, "device_token" varchar, "config_id" integer, "config_type" varchar, "data" text, "error" varchar, "sent_at" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
238
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_notifications_on_type" ON "rpn_notifications" ("type")
|
239
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
240
|
+
FROM sqlite_master
|
241
|
+
WHERE name='index_rpn_notifications_on_type' AND type='index'
|
242
|
+
UNION ALL
|
243
|
+
SELECT sql
|
244
|
+
FROM sqlite_temp_master
|
245
|
+
WHERE name='index_rpn_notifications_on_type' AND type='index'
|
246
|
+
[0m
|
247
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_notifications_on_config_id_and_config_type" ON "rpn_notifications" ("config_id", "config_type")
|
248
|
+
[1m[36m (0.2ms)[0m [1mCREATE TABLE "rpn_bulk_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar, "device_tokens" text, "config_id" integer, "config_type" varchar, "data" text, "failed" integer, "succeeded" integer, "sent_at" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
249
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_bulk_notifications_on_type" ON "rpn_bulk_notifications" ("type")
|
250
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
251
|
+
FROM sqlite_master
|
252
|
+
WHERE name='index_rpn_bulk_notifications_on_type' AND type='index'
|
253
|
+
UNION ALL
|
254
|
+
SELECT sql
|
255
|
+
FROM sqlite_temp_master
|
256
|
+
WHERE name='index_rpn_bulk_notifications_on_type' AND type='index'
|
257
|
+
[0m
|
258
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_rpn_bulk_notifications_on_config_id_and_config_type" ON "rpn_bulk_notifications" ("config_id", "config_type")
|
259
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "2"]]
|
260
|
+
[1m[35m (0.0ms)[0m commit transaction
|
261
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
262
|
+
[1m[35m (0.1ms)[0m rollback transaction
|