Created
September 23, 2014 01:23
-
-
Save ImagoTrigger/dd5096b7d71f5b2fde82 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use common::sense; | |
use DBI; | |
our $dbh = DBI->connect('dbi:Pg:dbname=discourse', 'discourse', undef) or die "$!"; | |
our $inst = $dbh->prepare(q{INSERT INTO topics (title, last_posted_at, created_at, updated_at, views, posts_count, user_id, last_post_user_id, reply_count, featured_user1_id, | |
featured_user2_id, featured_user3_id, avg_time, deleted_at, highest_post_number, image_url, off_topic_count, like_count, incoming_link_count, bookmark_count, star_count, | |
category_id, visible, moderator_posts_count, closed, archived, bumped_at, has_summary, vote_count, archetype, featured_user4_id, notify_moderators_count, spam_count, | |
illegal_count, inappropriate_count, pinned_at, score, percent_rank, notify_user_count, subtype, slug, auto_close_at, auto_close_user_id, auto_close_started_at, | |
deleted_by_id, participant_count, word_count, excerpt, pinned_globally) VALUES | |
(?,NOW(),NOW(),NOW(),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,NOW(),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}) or die $!; | |
our $inst2 = $dbh->prepare(q{INSERT INTO posts (user_id, topic_id, post_number, raw, cooked, created_at, updated_at, reply_to_post_number, reply_count, quote_count, deleted_at, | |
off_topic_count, like_count, incoming_link_count, bookmark_count, avg_time, score, reads, post_type, vote_count, sort_order, last_editor_id, hidden, hidden_reason_id, | |
notify_moderators_count, spam_count, illegal_count, inappropriate_count, last_version_at, user_deleted, reply_to_user_id, percent_rank, notify_user_count, like_score, | |
deleted_by_id, edit_reason, word_count, version, cook_method, wiki, baked_at, baked_version, hidden_at, self_edits, reply_quoted, via_email) VALUES | |
(?,?,?,?,?,NOW(),NOW(),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,NOW(),?,?,?,?,?,?,?,?,?,?,?,NOW(),?,?,?,?,?)}) or die $!; | |
$inst->execute('Test Post2',3,1,-1,-1,0,undef,undef,undef,undef,undef,1,undef,0,0,0,0,0,9,'t',0,'f','f','f',0,'regular',undef,0,0,0,0,undef,0,0,0,undef,'test-post2',undef,undef,undef,undef,1,128,'excerpt goes here','f'); | |
my $tid = $dbh->last_insert_id(undef,undef,"topics",undef); | |
$inst2->execute(-1,$tid,1,"Test post is testing","Test post is testing",undef,0,0,undef,0,0,0,0,0,2,3,1,0,1,-1,0,undef,0,0,0,0,0,undef,0,0,0,undef,undef,43,2,2,'f',1,undef,0,0,0); | |
$inst->finish; | |
$inst2->finish; | |
$dbh->disconnect; | |
exit 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment