Skip to content

Commit

Permalink
Added poll schema
Browse files Browse the repository at this point in the history
- Created poll schema, configuration, and initial DB
  • Loading branch information
weierophinney committed Oct 1, 2010
1 parent 0fdac00 commit 70ca2a2
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 1 deletion.
64 changes: 64 additions & 0 deletions widgets-as-helpers/.vimproject
@@ -0,0 +1,64 @@
widgets="/home/matthew/git/zf-examples/widgets-as-helpers" CD=. filter="*.php *.phtml *.css *.js *.sql TODO README ^.git" {
application=application {
Bootstrap.php
configs=configs {
}
controllers=controllers {
ErrorController.php
IndexController.php
}
models=models {
}
modules=modules {
poll=poll {
configs=configs {
poll.ini
}
controllers=controllers {
}
data=data {
}
models=models {
sql=sql {
poll.sql
}
}
views=views {
filters=filters {
}
helpers=helpers {
}
scripts=scripts {
}
}
}
}
views=views {
helpers=helpers {
}
scripts=scripts {
error=error {
error.phtml
}
index=index {
index.phtml
}
}
}
}
docs=docs {
}
library=library {
}
public=public {
index.php
}
tests=tests {
application=application {
bootstrap.php
}
library=library {
bootstrap.php
}
}
}
16 changes: 15 additions & 1 deletion widgets-as-helpers/.zfproject.xml
Expand Up @@ -16,7 +16,21 @@
<formsDirectory enabled="false"/>
<layoutsDirectory enabled="false"/>
<modelsDirectory/>
<modulesDirectory enabled="false"/>
<modulesDirectory>
<moduleDirectory moduleName="poll">
<apisDirectory enabled="false"/>
<configsDirectory enabled="false"/>
<controllersDirectory/>
<formsDirectory enabled="false"/>
<layoutsDirectory enabled="false"/>
<modelsDirectory/>
<viewsDirectory>
<viewScriptsDirectory/>
<viewHelpersDirectory/>
<viewFiltersDirectory/>
</viewsDirectory>
</moduleDirectory>
</modulesDirectory>
<viewsDirectory>
<viewScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Index">
Expand Down
7 changes: 7 additions & 0 deletions widgets-as-helpers/application/modules/poll/configs/poll.ini
@@ -0,0 +1,7 @@
[production]
db.adapter = "pdo_sqlite"
db.params.dbname = APPLICATION_PATH "/modules/poll/data/polls.db"

[testing : production]

[development : production]
Binary file not shown.
24 changes: 24 additions & 0 deletions widgets-as-helpers/application/modules/poll/models/sql/poll.sql
@@ -0,0 +1,24 @@
CREATE TABLE IF NOT EXISTS polls (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
name VARCHAR(256) NOT NULL
);

CREATE TABLE IF NOT EXISTS questions (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
poll_id INTEGER NOT NULL,
question TEXT NOT NULL
);

CREATE TABLE IF NOT EXISTS answers (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
question_id INTEGER NOT NULL,
answer TEXT NOT NULL
);

CREATE TABLE IF NOT EXISTS votes (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
answer_id INTEGER NOT NULL,
ip_address INTEGER NOT NULL,
user_agent TEXT NOT NULL,
session_id TEXT NOT NULL
);

0 comments on commit 70ca2a2

Please sign in to comment.