Permalink
Browse files

finalized (?) tank_auth schema

  • Loading branch information...
1 parent 1d2996a commit d8e661352c8c44e02549a2441b63f647b3bfb5cf @cpf-ch cpf-ch committed May 24, 2011
Showing with 50 additions and 9 deletions.
  1. +3 −0 .gitignore
  2. +19 −8 schema/Makefile
  3. +9 −0 schema/unix_timestamp.sql
  4. +17 −0 schema/user_profiles.sql
  5. +2 −1 schema/users.sql
View
3 .gitignore
@@ -0,0 +1,3 @@
+application/logs/*
+htdocs/captcha/*.jpg
+application/cache/*
View
27 schema/Makefile
@@ -19,22 +19,33 @@ deploy: $(items_done)
perms:
reset:
+ ./bootstrap.sh
#=======================================================================
-.ci_sessions.done:
+.ci_sessions.done: ci_sessions.sql
-.login_attempts.done:
+.login_attempts.done: login_attempts.sql
-.users.done:
+.plpgsql.done: plpgsql.sql
-.plpgsql.done:
+.unix_timestamp.done: unix_timestamp.sql
-.update_column_last_login.done .update_column_modified.done .update_column_time.done: .plpgsql.done
+.update_column_last_login.done: update_column_last_login.sql .plpgsql.done
-.update_login_attempts_time.done: .update_column_time.done .login_attempts.done
+.update_column_modified.done: update_column_modified.sql .plpgsql.done
-.update_user_autologin_last_login.done: .update_column_last_login.done .user_autologin.done
+.update_column_time.done: update_column_time.sql .plpgsql.done
-.update_users_modified.done: .update_column_modified.done .users.done
+.update_login_attempts_time.done: update_login_attempts_time.sql .update_column_time.done .login_attempts.done
+
+.update_user_autologin_last_login.done: update_user_autologin_last_login.sql .update_column_last_login.done .user_autologin.done
+
+.update_users_modified.done: update_users_modified.sql .update_column_modified.done .users.done
+
+.user_autologin.done: user_autologin.sql
+
+.user_profiles.done: user_profiles.sql .users.done
+
+.users.done: users.sql
View
9 schema/unix_timestamp.sql
@@ -0,0 +1,9 @@
+
+create or replace function unix_timestamp() returns integer as $$
+select round(extract(epoch from abstime(now())))::int4 as result;
+$$ language 'sql';
+
+create or replace function unix_timestamp(timestamp with time zone) returns integer as $$
+select round(extract(epoch from abstime($1)))::int4 as result;
+$$ language 'sql';
+
View
17 schema/user_profiles.sql
@@ -0,0 +1,17 @@
+
+drop table if exists user_profiles restrict;
+
+drop sequence if exists user_profiles_id_seq restrict;
+
+create sequence user_profiles_id_seq;
+
+create table user_profiles (
+ id integer not null default nextval('user_profiles_id_seq'),
+ user_id integer not null,
+ country varchar(20) default null,
+ website varchar(255) default null,
+ primary key (id)
+);
+
+alter sequence user_profiles_id_seq owned by user_profiles.id;
+
View
3 schema/users.sql
@@ -22,7 +22,8 @@ create table users (
last_ip inet not null,
last_login timestamp with time zone not null default CURRENT_TIMESTAMP,
created timestamp with time zone not null default CURRENT_TIMESTAMP,
- modified timestamp with time zone not null default CURRENT_TIMESTAMP
+ modified timestamp with time zone not null default CURRENT_TIMESTAMP,
+ primary key (id)
);
alter sequence users_id_seq owned by users.id;

0 comments on commit d8e6613

Please sign in to comment.