Skip to content

Commit 3bb4cca

Browse files
author
dfeng99
committed
add sql script to create database and tables
1 parent 9aecb36 commit 3bb4cca

File tree

2 files changed

+115
-1
lines changed

2 files changed

+115
-1
lines changed

DapiPush.sql

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
-- phpMyAdmin SQL Dump
2+
-- version 4.5.4.1deb2ubuntu2
3+
-- http://www.phpmyadmin.net
4+
--
5+
-- 主機: localhost
6+
-- 產生時間: 2018 年 05 月 14 日 21:41
7+
-- 伺服器版本: 5.7.22-0ubuntu0.16.04.1
8+
-- PHP 版本: 7.0.28-0ubuntu0.16.04.1
9+
10+
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11+
SET time_zone = "+00:00";
12+
13+
14+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
15+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
16+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
17+
/*!40101 SET NAMES utf8mb4 */;
18+
19+
--
20+
-- 資料庫: `DapiPush`
21+
--
22+
CREATE DATABASE IF NOT EXISTS `DapiPush` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
23+
USE `DapiPush`;
24+
25+
-- --------------------------------------------------------
26+
27+
--
28+
-- 資料表結構 `notification_push_blacklist`
29+
--
30+
31+
DROP TABLE IF EXISTS `notification_push_blacklist`;
32+
CREATE TABLE `notification_push_blacklist` (
33+
`provider` set('apns','fcm') COLLATE utf8mb4_unicode_ci NOT NULL,
34+
`to_token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
35+
`user_id` int(11) NOT NULL,
36+
`timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
37+
`state` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'sent_request'
38+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
39+
40+
--
41+
-- 表的關聯 `notification_push_blacklist`:
42+
--
43+
44+
-- --------------------------------------------------------
45+
46+
--
47+
-- 資料表結構 `Statistics`
48+
--
49+
50+
DROP TABLE IF EXISTS `Statistics`;
51+
CREATE TABLE `Statistics` (
52+
`user_id` int(11) NOT NULL,
53+
`provider` set('apns','fcm') COLLATE utf8mb4_unicode_ci NOT NULL,
54+
`last_access` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
55+
`counter` bigint(20) NOT NULL DEFAULT '0'
56+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
57+
58+
--
59+
-- 表的關聯 `Statistics`:
60+
--
61+
62+
-- --------------------------------------------------------
63+
64+
--
65+
-- 資料表結構 `users`
66+
--
67+
68+
DROP TABLE IF EXISTS `users`;
69+
CREATE TABLE `users` (
70+
`id` int(11) NOT NULL,
71+
`username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
72+
`password` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
73+
`email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL
74+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
75+
76+
--
77+
-- 表的關聯 `users`:
78+
--
79+
80+
--
81+
-- 已匯出資料表的索引
82+
--
83+
84+
--
85+
-- 資料表索引 `notification_push_blacklist`
86+
--
87+
ALTER TABLE `notification_push_blacklist`
88+
ADD PRIMARY KEY (`to_token`),
89+
ADD KEY `user_id` (`user_id`);
90+
91+
--
92+
-- 資料表索引 `Statistics`
93+
--
94+
ALTER TABLE `Statistics`
95+
ADD PRIMARY KEY (`user_id`,`provider`);
96+
97+
--
98+
-- 資料表索引 `users`
99+
--
100+
ALTER TABLE `users`
101+
ADD PRIMARY KEY (`id`);
102+
103+
--
104+
-- 在匯出的資料表使用 AUTO_INCREMENT
105+
--
106+
107+
--
108+
-- 使用資料表 AUTO_INCREMENT `users`
109+
--
110+
ALTER TABLE `users`
111+
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
112+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
113+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
114+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

src/main/java/com/bzcentre/dapiPush/DapiReceiver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public Object[] invoke(Map<String, Object> request) {
200200
NginxClojureRT.log.info(TAG+"user "+user_id+" is sending "+invitees.size()+" push token(s) to user(s) "
201201
+g.toJson(invitees.get(0).getPayload().getAcme7()));
202202
// receipient={"fcm_token","apns_token","payload"}
203-
// payload class is as APNS message payload, FCM needs to re-arrange it.
203+
// payload class is as APNS message payload defined, FCM needs to map to it.
204204
msgCounter.countdown = invitees.size();
205205
NginxClojureRT.log.info(TAG+"msgCounter[countdown,apns,fcm]:"+msgCounter.list());
206206
for(Receipient receipient : invitees){

0 commit comments

Comments
 (0)