summaryrefslogtreecommitdiffstats
path: root/sql_scripts
diff options
context:
space:
mode:
authorAdolfo Fitoria <fitoria@fitoria-laptop.(none)>2010-02-09 14:56:49 -0600
committerAdolfo Fitoria <fitoria@fitoria-laptop.(none)>2010-02-09 14:56:49 -0600
commit81e2244eca04c02de0d7c32f0063f64f2ca3b1c4 (patch)
tree1014127ab7b69d121aa2fe4ed80de5a43e7b078a /sql_scripts
parent9d1fb9890b97beb55461ca34f9757bc685461130 (diff)
parent3e7c42f81352ad73a1395ed0601f2d4fdf9b5359 (diff)
downloadaskbot-81e2244eca04c02de0d7c32f0063f64f2ca3b1c4.tar.gz
askbot-81e2244eca04c02de0d7c32f0063f64f2ca3b1c4.tar.bz2
askbot-81e2244eca04c02de0d7c32f0063f64f2ca3b1c4.zip
Merge branch 'master' of git://github.com/evgenyfadeev/CNPROG into evgenyfadeev/master
Conflicts: forum/management/commands/send_email_alerts.py locale/en/LC_MESSAGES/django.mo settings.py templates/about.html templates/authopenid/complete.html templates/authopenid/external_legacy_login_info.html templates/content/js/com.cnprog.post.js templates/content/js/com.cnprog.utils.js templates/content/style/style.css templates/question.html templates/questions.html
Diffstat (limited to 'sql_scripts')
-rw-r--r--sql_scripts/100108_upgrade_ef.sql4
-rw-r--r--sql_scripts/badges.sql37
-rw-r--r--sql_scripts/drop-all-tables.sh4
-rw-r--r--sql_scripts/drop-auth.sql8
-rw-r--r--sql_scripts/pg_fts_install.sql38
-rwxr-xr-xsql_scripts/update_2010_01_23.sql9
6 files changed, 100 insertions, 0 deletions
diff --git a/sql_scripts/100108_upgrade_ef.sql b/sql_scripts/100108_upgrade_ef.sql
new file mode 100644
index 00000000..1c9a5c1c
--- /dev/null
+++ b/sql_scripts/100108_upgrade_ef.sql
@@ -0,0 +1,4 @@
+alter table auth_user add column hide_ignored_questions tinyint(1) not NULL;
+update auth_user set hide_ignored_questions=0;
+alter table auth_user add column tag_filter_setting varchar(16) not NULL;
+update auth_user set tag_filter_setting='ignored';
diff --git a/sql_scripts/badges.sql b/sql_scripts/badges.sql
new file mode 100644
index 00000000..5fd03d18
--- /dev/null
+++ b/sql_scripts/badges.sql
@@ -0,0 +1,37 @@
+INSERT INTO badge ( id, name, type, slug, description, multiple, awarded_count) VALUES
+(1, 'Disciplined', 3, 'disciplined', 'Deleted own post with score of 3 or higher', TRUE, 0),
+(2, 'Peer Pressure', 3, 'peer-pressure', 'Deleted own post with score of -3 or lower', TRUE, 0),
+(3, 'Nice answer', 3, 'nice-answer', 'Answer voted up 10 times', TRUE, 0),
+(4, 'Nice Question', 3, 'nice-question', 'Question voted up 10 times', TRUE, 0),
+(5, 'Pundit', 3, 'pundit', 'Left 10 comments with score of 10 or more', FALSE, 0),
+(6, 'Popular Question', 3, 'popular-question', 'Asked a question with 1,000 views', TRUE, 0),
+(7, 'Citizen patrol', 3, 'citizen-patrol', 'First flagged post', FALSE, 0),
+(8, 'Cleanup', 3, 'cleanup', 'First rollback', FALSE, 0),
+(9, 'Critic', 3, 'critic', 'First down vote', FALSE, 0),
+(10, 'Editor', 3, 'editor', 'First edit', FALSE, 0),
+(11, 'Organizer', 3, 'organizer', 'First retag', FALSE, 0),
+(12, 'Scholar', 3, 'scholar', 'First accepted answer on your own question', FALSE, 0),
+(13, 'Student', 3, 'student', 'Asked first question with at least one up vote', FALSE, 0),
+(14, 'Supporter', 3, 'supporter', 'First up vote', FALSE, 0),
+(15, 'Teacher', 3, 'teacher', 'Answered first question with at least one up vote', FALSE, 0),
+(16, 'Autobiographer', 3, 'autobiographer', 'Completed all user profile fields', FALSE, 0),
+(17, 'Self-Learner', 3, 'self-learner', 'Answered your own question with at least 3 up votes', TRUE, 0),
+(18, 'Great Answer', 1, 'great-answer', 'Answer voted up 100 times', TRUE, 0),
+(19, 'Great Question', 1, 'great-question', 'Question voted up 100 times', TRUE, 0),
+(20, 'Stellar Question', 1, 'stellar-question', 'Question favorited by 100 users', TRUE, 0),
+(21, 'Famous question', 1, 'famous-question', 'Asked a question with 10,000 views', TRUE, 0),
+(22, 'Alpha', 2, 'alpha', 'Actively participated in the private alpha', FALSE, 0),
+(23, 'Good Answer', 2, 'good-answer', 'Answer voted up 25 times', TRUE, 0),
+(24, 'Good Question', 2, 'good-question', 'Question voted up 25 times', TRUE, 0),
+(25, 'Favorite Question', 2, 'favorite-question', 'Question favorited by 25 users', TRUE, 0),
+(26, 'Civic duty', 2, 'civic-duty', 'Voted 300 times', FALSE, 0),
+(27, 'Strunk & White', 2, 'strunk-and-white', 'Edited 100 entries', FALSE, 0),
+(28, 'Generalist', 2, 'generalist', 'Active in many different tags', FALSE, 0),
+(29, 'Expert', 2, 'export', 'Very active in one tag', FALSE, 0),
+(30, 'Yearling', 2, 'yearling', 'Active member for a year', FALSE, 0),
+(31, 'Notable Question', 2, 'notable-question', 'Asked a question with 2,500 views', TRUE, 0),
+(32, 'Enlightened', 2, 'enlightened', 'First answer was accepted with at least 10 up votes', FALSE, 0),
+(33, 'Beta', 2, 'beta', 'Actively participated in the private beta', FALSE, 0),
+(34, 'Guru', 2, 'guru', 'Accepted answer and voted up 40 times', TRUE, 0),
+(35, 'Necromancer', 2, 'necromancer', 'Answered a question more than 60 days later with at least 5 votes', TRUE, 0),
+(36, 'Taxonomist', 2, 'taxonomist', 'Created a tag used by 50 questions', TRUE, 0);
diff --git a/sql_scripts/drop-all-tables.sh b/sql_scripts/drop-all-tables.sh
new file mode 100644
index 00000000..1e55cb1f
--- /dev/null
+++ b/sql_scripts/drop-all-tables.sh
@@ -0,0 +1,4 @@
+mysql_username=''
+mysql_database=''
+mysqldump -u $mysql_username -p --add-drop-table --no-data $mysql_database | grep ^DROP
+#| mysql -u[USERNAME] -p[PASSWORD] [DATABASE]
diff --git a/sql_scripts/drop-auth.sql b/sql_scripts/drop-auth.sql
new file mode 100644
index 00000000..bc17dce3
--- /dev/null
+++ b/sql_scripts/drop-auth.sql
@@ -0,0 +1,8 @@
+drop table auth_group;
+drop table auth_group_permissions;
+drop table auth_message;
+drop table auth_permission;
+drop table auth_user;
+drop table auth_user_groups;
+drop table auth_user_user_permissions;
+
diff --git a/sql_scripts/pg_fts_install.sql b/sql_scripts/pg_fts_install.sql
new file mode 100644
index 00000000..d0655134
--- /dev/null
+++ b/sql_scripts/pg_fts_install.sql
@@ -0,0 +1,38 @@
+ALTER TABLE question ADD COLUMN tsv tsvector;
+
+CREATE OR REPLACE FUNCTION public.create_plpgsql_language ()
+ RETURNS TEXT
+ AS $$
+ CREATE LANGUAGE plpgsql;
+ SELECT 'language plpgsql created'::TEXT;
+ $$
+LANGUAGE 'sql';
+
+SELECT CASE WHEN
+ (SELECT true::BOOLEAN
+ FROM pg_language
+ WHERE lanname='plpgsql')
+ THEN
+ (SELECT 'language already installed'::TEXT)
+ ELSE
+ (SELECT public.create_plpgsql_language())
+ END;
+
+DROP FUNCTION public.create_plpgsql_language ();
+
+CREATE OR REPLACE FUNCTION set_question_tsv() RETURNS TRIGGER AS $$
+begin
+ new.tsv :=
+ setweight(to_tsvector('english', coalesce(new.tagnames,'')), 'A') ||
+ setweight(to_tsvector('english', coalesce(new.title,'')), 'B') ||
+ setweight(to_tsvector('english', coalesce(new.summary,'')), 'C');
+ RETURN new;
+end
+$$ LANGUAGE plpgsql;
+
+CREATE TRIGGER tsvectorupdate BEFORE INSERT OR UPDATE
+ON question FOR EACH ROW EXECUTE PROCEDURE set_question_tsv();
+
+CREATE INDEX blog_entry_tsv ON blog_entry USING gin(body_tsv);
+
+UPDATE question SET title = title;
diff --git a/sql_scripts/update_2010_01_23.sql b/sql_scripts/update_2010_01_23.sql
new file mode 100755
index 00000000..621207be
--- /dev/null
+++ b/sql_scripts/update_2010_01_23.sql
@@ -0,0 +1,9 @@
+CREATE TABLE `fbconnect_fbassociation` (
+ `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ `user_id` integer NOT NULL,
+ `fbuid` varchar(12) NOT NULL UNIQUE
+)
+;
+ALTER TABLE `fbconnect_fbassociation` ADD CONSTRAINT `user_id_refs_id_3534873d`
+FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);
+CREATE INDEX `fbconnect_fbassociation_user_id` ON `fbconnect_fbassociation` (`user_id`);