Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
koistya committed Feb 21, 2016
0 parents commit 8e50cf6
Show file tree
Hide file tree
Showing 10 changed files with 169 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org

root = true

[*]
# Change these settings to your own preference
indent_style = space
indent_size = 2

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.sql]
indent_size = 2

[*.md]
trim_trailing_whitespace = false
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2016 Membership Database contributors. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Membership Database Schema

> Membership database schema boilerplate for
> [PostgreSQL](https://aws.amazon.com/rds/postgresql/),
> [SQL Server](https://azure.microsoft.com/services/sql-database/),
> [Oracle](https://aws.amazon.com/rds/oracle/), and [SQLite](http://sqlite.org/).
> It is optimized for use in web applications where you need high
> interoperability between data model(s) and JavaScript objects (see
> [GraphQL](http://graphql.org/)). The database contains everything you need to
> store user account information, user roles, and authentication tokens /
> claims. Feel free to use it either as a boilerplate when starting a new web
> application project, or simply as a reference implementation.
See [PostgreSQL implementation](https://github.com/membership/membership.db/tree/master/postgres),
other implementations are coming soon. Want to help? Let's [get in touch](mailto:hello@tarkus.me)!

### To-Do List

[![todo](https://dl.dropboxusercontent.com/u/16006521/membership/todo.png)](https://waffle.io/membership/membership.db)

### Collaborators

* Konstantin Tarkus ([@koistya](https://twitter.com/koistya))
* Vladimir Kutepov ([@frenzzy](https://github.com/frenzzy))

### Related Projects

* [React Starter Kit](https://github.com/kriasoft/react-starter-kit) — Isomorphic web app boilerplate (Node.js, GraphQL, React)

### License

Copyright © 2016 Membership Database contributors. This source code is licensed
under the MIT license found in the [LICENSE.txt](https://github.com/membership/membership.db/blob/master/LICENSE.txt)
file. The documentation to the project is licensed under the
[CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/) license.
7 changes: 7 additions & 0 deletions mssql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Membership Database Schema for SQL Server

### System Requirements

* [Azure SQL Database](https://azure.microsoft.com/services/sql-database/), or
* [Microsoft SQL Server 2012](https://www.microsoft.com/server-cloud/products/sql-server/) and higher, or
* [LocalDB 2012](https://www.microsoft.com/server-cloud/products/sql-server-editions/sql-server-express.aspx) and higher
6 changes: 6 additions & 0 deletions oracle/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Membership Database Schema for Oracle

### System Requirements

* [Oracle](https://www.oracle.com/database/) 12c and higher, or
* [Amazon RDS for Oracle](https://aws.amazon.com/rds/oracle/)
6 changes: 6 additions & 0 deletions postgres/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Membership Database Schema for PostgreSQL

### System Requirements

* [PostgreSQL](http://www.postgresql.org/) 9.1 and higher, or
* [Amazon RDS for PostgreSQL](https://aws.amazon.com/rds/postgresql/)
26 changes: 26 additions & 0 deletions postgres/User.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--------------------------------------------------------------------------------
-- Membership Database Schema
-- https://github.com/membership/membership.db
--
-- Copyright © 2016 Membership Database contributors.
--
-- This source code is licensed under the MIT license found in the
-- LICENSE.txt file in the root directory of this source tree.
--------------------------------------------------------------------------------

CREATE TABLE "User" (
"id" uuid NOT NULL DEFAULT uuid_generate_v1mc(),
"email" character varying(256),
"emailConfirmed" boolean NOT NULL DEFAULT false,
"passwordHash" character varying(100),
"securityStamp" character varying(100),
"phone" character varying(50),
"phoneConfirmed" boolean NOT NULL DEFAULT false,
"twoFactorEnabled" boolean NOT NULL DEFAULT false,
"lockoutEnd" timestamp without time zone,
"lockoutEnabled" boolean NOT NULL DEFAULT false,
"accessFailedCount" smallint NOT NULL DEFAULT 0,
-- Keys
CONSTRAINT "User_pkey" PRIMARY KEY (id),
CONSTRAINT "User_email_unq" UNIQUE (email)
);
21 changes: 21 additions & 0 deletions postgres/UserClaim.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--------------------------------------------------------------------------------
-- Membership Database Schema
-- https://github.com/membership/membership.db
--
-- Copyright © 2016 Membership Database contributors.
--
-- This source code is licensed under the MIT license found in the
-- LICENSE.txt file in the root directory of this source tree.
--------------------------------------------------------------------------------

CREATE TABLE "UserClaim" (
"id" uuid NOT NULL DEFAULT uuid_generate_v1mc(),
"userId" uuid NOT NULL,
"type" character varying(250),
"value" character varying(4000),
-- Keys
CONSTRAINT "UserClaim_pkey" PRIMARY KEY (id),
CONSTRAINT "UserClaim_User_fkey" FOREIGN KEY ("userId")
REFERENCES "User" (id) MATCH SIMPLE
ON DELETE CASCADE ON UPDATE CASCADE
);
20 changes: 20 additions & 0 deletions postgres/UserLogin.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--------------------------------------------------------------------------------
-- Membership Database Schema
-- https://github.com/membership/membership.db
--
-- Copyright © 2016 Membership Database contributors.
--
-- This source code is licensed under the MIT license found in the
-- LICENSE.txt file in the root directory of this source tree.
--------------------------------------------------------------------------------

CREATE TABLE "UserLogin" (
"userId" uuid NOT NULL,
"name" character varying(50),
"key" character varying(100),
-- Keys
CONSTRAINT "UserLogin_pkey" PRIMARY KEY (name, key),
CONSTRAINT "UserLogin_User_fkey" FOREIGN KEY ("userId")
REFERENCES "User" (id) MATCH SIMPLE
ON DELETE CASCADE ON UPDATE CASCADE
);
5 changes: 5 additions & 0 deletions sqlite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Membership Database Schema for SQLite

### System Requirements

* [SQLite](http://sqlite.org/) 3.10 and higher

0 comments on commit 8e50cf6

Please sign in to comment.