Comments (5)
You sure can have as many reporters as you need. You just have to write the support code to go along with it.
Another option is you can create a MySQL "view" which Phreeze treats about the same as a table, but is read-only. If you haven't used views before, basically they are just a query that you write and MySQL saves it and treats it kinda like a table. The main advantage to using a view is that Phreeze Builder will generate the plumbing code for you.
from phreeze.
That's nice. I will read up on Views.
from phreeze.
Ok I have been playing around with MySQl and tried to get this View thing in my head.
These are the tables for the internal messaging system
CREATE TABLE IF NOT EXISTS `tb_messages` (
`message_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`message_from` bigint(20) unsigned NOT NULL,
`message_to` bigint(20) unsigned NOT NULL,
`message_title` varchar(255) NOT NULL DEFAULT '',
`message_content` longtext NOT NULL DEFAULT '',
`message_date` timestamp,
PRIMARY KEY (`message_id`),
CONSTRAINT `sender` FOREIGN KEY (`message_from`) REFERENCES `tb_accounts` (`account_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `receiver` FOREIGN KEY (`message_to`) REFERENCES `tb_accounts` (`account_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tb_messageviewed` (
`mv_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`message_id` bigint(20) unsigned NOT NULL,
`account_id` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`mv_id`),
CONSTRAINT `mv_message` FOREIGN KEY (`message_id`) REFERENCES `tb_messages` (`message_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `mv_account` FOREIGN KEY (`account_id`) REFERENCES `tb_accounts` (`account_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
These are the Views to show latest messages and the total new messages for the currentUser
CREATE OR REPLACE VIEW `view_new_msg` AS
SELECT *
FROM tb_messages t1
WHERE NOT EXISTS (
SELECT *
FROM tb_messageviewed t2
WHERE t1.message_id LIKE t2.message_id ) + '%'
CREATE OR REPLACE VIEW `view_new_msg_total` AS
SELECT message_to, COUNT(message_id) total_new
FROM `view_new_msg`
GROUP BY message_to
ORDER BY total_new DESC
Will Phreeze understand the way I created the views?
from phreeze.
Yes it works really well
from phreeze.
awesome!
from phreeze.
Related Issues (20)
- Greetings HOT 1
- Error after building
- Its work wordpress 4.8+?
- Phreeze Builder Broken HOT 1
- master-detail / master-detail-detail examples
- builder/analyze gives 404 on Nginx
- Generated code in scripts/model.js displays all tables regardless
- index null HOT 1
- Controler filename / classname containing space character(s)
- Stuck loading tables with varbinary?
- Error Opening MySQL Database HOT 1
- analyze Not Found HOT 1
- after instalation HOT 2
- Undefined offset: 1 in DBTable.php at line 285 HOT 1
- Jason Hinkle 1970-2016 HOT 5
- Security issue : use hash_equals() instead of '===' to compare hashes
- Show on select many-to-one
- http://192.168.32.10/phreeze/builder/analyze HOT 1
- Foreign key issue
- Problem after builder page HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phreeze.