Cocoa UltraSms Database structure - mysql

Here's a quicky:
Can someone tell me the table structure that cocoa ultrasms creates or give me a link to a dump of the database? (2 tables)
Cocoa UltraSms is mac only, but I only have my windows machine with me, and I need to recreate the database structure.

well, just in case someone else would ever need it ... smsin tabel:
CREATE TABLE `smsin` (
`id` int(11) unsigned NOT NULL auto_increment,
`service` varchar(20) NOT NULL default '',
`service_number_type` varchar(16) NOT NULL default 'Unknown',
`service_number_npi` varchar(16) NOT NULL default 'Unknown',
`status_report_sent` int(1) unsigned NOT NULL default '0',
`sender` varchar(20) NOT NULL default '',
`sender_number_type` varchar(16) NOT NULL default 'Unknown',
`sender_number_npi` varchar(16) NOT NULL default 'Unknown',
`timestmp` varchar(14) NOT NULL default '',
`message` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=25 ;

Related

Table doesn't appear to be accepting new rows?

It has come to my attention that one of my websites is not allowing users to register. Upon looking through the table and running through different scenarios it appears as if my table isn't allowing any more rows.
I'm on PHP 7.0 running MariaDB on cPanel. My table was at 499 rows and I could not add a new user from the script I haven't changed in years. I tested the code on a new table and it inserted the value just fine and the rest of the script executes just fine. This is leading me to believe it's something with the table.
CREATE TABLE `members` (
`id` int(10) NOT NULL,
`name` varchar(30) NOT NULL DEFAULT '',
`ipaddress` varchar(15) NOT NULL DEFAULT '',
`salt` varchar(32) NOT NULL DEFAULT '',
`gender` varchar(10) NOT NULL DEFAULT '',
`country` varchar(2) NOT NULL DEFAULT '',
`password` varchar(33) NOT NULL DEFAULT '',
`email` varchar(400) NOT NULL DEFAULT '',
`lastactive` varchar(20) NOT NULL DEFAULT '',
`photo` varchar(100) NOT NULL DEFAULT '',
`about` text NOT NULL,
`intrests` text NOT NULL,
`aim` varchar(15) NOT NULL DEFAULT '',
`yahoo` varchar(25) NOT NULL DEFAULT '',
`msn` varchar(25) NOT NULL DEFAULT '',
`website` varchar(30) NOT NULL DEFAULT '',
`points` int(10) NOT NULL DEFAULT 0,
`view` char(1) NOT NULL DEFAULT '',
`joined` timestamp NOT NULL DEFAULT current_timestamp(),
`act` char(1) NOT NULL DEFAULT '',
`xlink` varchar(30) NOT NULL,
`isstaff` int(1) NOT NULL DEFAULT 0,
`stgr` int(3) NOT NULL,
`rights` int(3) NOT NULL,
`stpr` int(10) NOT NULL,
`trs` varchar(30) NOT NULL,
`sttitle` varchar(60) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Indexes for table `members`
--
ALTER TABLE `members`
ADD PRIMARY KEY (`id`),
ADD KEY `id` (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `members`
--
ALTER TABLE `members`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=502;
COMMIT;
///Here is the insert code for my PHP script
mysqli_query($connection, "INSERT INTO members (name,ipaddress,salt,gender,country,password,email,act) VALUES (
'".mysqli_real_escape_string( $connection, $member['name'])."',
'".mysqli_real_escape_string( $connection, $ip)."',
'".mysqli_real_escape_string( $connection, $enurl)."',
'".mysqli_real_escape_string( $connection, $member['gender'])."',
'".mysqli_real_escape_string( $connection, $member['country'])."',
'".mysqli_real_escape_string( $connection, $pass2)."',
'".mysqli_real_escape_string( $connection, $member['email'])."',
'".mysqli_real_escape_string( $connection, $anumber)."')");
My error_log does not populate with any errors nor is there an error dumped on the page. Like I said the script runs it's course just fine inserting these same details into other tables.

How do you design a database schema for a user profile page

Trying to set up a user profile page for a job site. The database I plan to use is the MySQL database.
Looking into a few database design I came up with this schema.
First, the user management tables
CREATE TABLE `user` (
`user_id` int(11) NOT NULL,
`firstname` varchar(32) NOT NULL,
`lastname` varchar(32) NOT NULL,
`email` varchar(96) NOT NULL,
`mobile_number` varchar(32) NOT NULL,
`password` varchar(40) NOT NULL,
`salt` varchar(9) NOT NULL,
`address_id` int(11) NOT NULL DEFAULT '0',
`ip` varchar(40) NOT NULL,
`status` tinyint(1) NOT NULL,
`approved` tinyint(1) NOT NULL,
`registration_date` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `user_address` (
`user_id` int(11) NOT NULL,
`city` varchar(128) NOT NULL
`work_city` varchar(128) NOT NULL,
`postal_code` varchar(10) NOT NULL,
`country_id` int(11) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `user_description` (
`user_id` int(11) NOT NULL,
`description` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
and then the education table and work experience
CREATE TABLE `education_detail` (
`user_id` int(11) NOT NULL,
`certificate_degree_name` varchar(255) DEFAULT NULL,
`major` varchar(255) DEFAULT NULL,
`institute_university_name` varchar(255) DEFAULT NULL,
`start_date` date NOT NULL DEFAULT '0000-00-00',
`completion_date` date NOT NULL DEFAULT '0000-00-00'
)
CREATE TABLE `experience_detail` (
`user_id` int(11) NOT NULL,
`is_current_job` int(2) DEFAULT NULL,
`start_date` date NOT NULL DEFAULT '0000-00-00',
`end_date` date NOT NULL DEFAULT '0000-00-00',
`job_title` varchar(255) DEFAULT NULL,
`company_name` varchar(255) DEFAULT NULL,
`job_location_city` varchar(255) DEFAULT NULL,
`job_location_state` varchar(255) DEFAULT NULL,
`job_location_country` varchar(255) DEFAULT NULL,
`job_description` varchar(255) DEFAULT NULL
)
Note that user_id in table user_address, user_description, education_detail and experience_detail is a foreign key referencing it to the table user.
There are a few more table like skills, certification etc to which I plan on using user_id as a FK.
My question, is this database design good enough? Can you suggest me what should be done more to make the design much better?
Keep in mind not all will have work experience, some may be freshers.
Use InnoDB, not MyISAM. (There are many Q&A explaining 'why'.)
NULL or an empty string is perfectly fine for a missing description. Do you have any further argument for disliking such? (Meanwhile, InnoDB is more efficient at handling optional big strings.)
Every table should have a PRIMARY KEY; you don't seem to have any. The first table probably needs user_id as the PK. Read about AUTO_INCREMENT.
As with description, why is address in a separate table?
May I suggest this for country name/code/id:
country_code CHAR(2) CHARACTER SET ascii
Education is 1:many from users, so user_id cannot be the PK. Ditto for jobs.

MariaDB - CONNECT ENGINE - ORDER BY error

I'm trying to get Asterisk CDR records from MySQL table (5.5.45) by CONNECT engine on other server running MariaDB (10.0.29).
I can create the connection between table easily:
CREATE TABLE `calls` engine=CONNECT table_type=MYSQL
CONNECTION='mysql://user#IP/asteriskcdrdb/calls';
When I run simple SELECT * FROM calls, everything works good, when I add some WHERE conditions, still everything okay.
But the problem start when I add ORDER BY column parameter, then I got this error from MariaDB:
#1032 - Can't find record in 'calls'
I checked MySQL log, MariaDB log - there are no errors at all.
Did I miss something?
Thank you!
Update: The whole query is simple:
SELECT * FROM `calls` ORDER BY `calldate`
The table structure:
CREATE TABLE `calls` (
`calldate` datetime NOT NULL default '0000-00-00 00:00:00',
`clid` varchar(80) NOT NULL default '',
`src` varchar(80) NOT NULL default '',
`dst` varchar(80) NOT NULL default '',
`dcontext` varchar(80) NOT NULL default '',
`channel` varchar(80) NOT NULL default '',
`dstchannel` varchar(80) NOT NULL default '',
`lastapp` varchar(80) NOT NULL default '',
`lastdata` varchar(80) NOT NULL default '',
`duration` int(11) NOT NULL default '0',
`billsec` int(11) NOT NULL default '0',
`disposition` varchar(45) NOT NULL default '',
`amaflags` int(11) NOT NULL default '0',
`accountcode` varchar(20) NOT NULL default '',
`uniqueid` varchar(32) NOT NULL default '',
`userfield` varchar(255) NOT NULL default '',
`recordingfile` varchar(255) NOT NULL default '',
`cnum` varchar(40) NOT NULL default '',
`cnam` varchar(40) NOT NULL default '',
`outbound_cnum` varchar(40) NOT NULL default '',
`outbound_cnam` varchar(40) NOT NULL default '',
`dst_cnam` varchar(40) NOT NULL default '',
`call_charge` float NOT NULL default '0',
`from_did` varchar(30) NOT NULL,
`did` varchar(50) NOT NULL default '',
`user_id` int(8) unsigned default NULL,
`client_id` int(8) unsigned default NULL,
KEY `IDX_UNIQUEID` (`uniqueid`),
KEY `src` (`src`),
KEY `dst` (`dst`),
KEY `calldate` (`calldate`),
KEY `uniqueid` (`uniqueid`),
KEY `userfield` (`userfield`),
KEY `from_did` (`from_did`),
KEY `user_id` (`user_id`),
KEY `client_id` (`client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Update #2: Update the table names, to don't confuse, but it's not the issue. The CONNECTION table is created okay.
Query works:
SELECT * FROM `calls`
Query works:
SELECT * FROM `calls` WHERE `user_id`=X
Query return error:
SELECT * FROM `calls` ORDER BY `calldate`
Update #3: The MySQL was updated to veriosn 5.5.45, the type was changed to InnoDB and the charset was converted to UTF8. But no success.
PROBLEM SOLVED
Well, it's MariaDB bug, when I changed to FederatedX engine (which is basically little bit limited version of CONNECT), everything works as expected.
In your query you do
SELECT * FROM calls
but in your table structure you have
CREATE TABLE cdr
and both have calldate column. Check if you querying the right table.

Create table in magento module

I am new in magento. How can I create table in db ? I tried some code, but table didn't create. But in core_resource table I have setup my table. The version of my php file is match with version of my config file. Help me please, I am looking answer for that question two days , but nowhere can find anything.
There are many ways to create a table.
You can create table by direct phpmyadmin
write own sql and run that by php file
Both ways are applicable on magento too.
but if you are trying to create your own table by your own custom module then you have to play with xml and magento models.
I am providing you an example of module.
XML
<models>
<magenotification>
<class>Magestore_Magenotification_Model</class>
<resourceModel>magenotification_mysql4</resourceModel>
</magenotification>
<magenotification_mysql4>
<class>Magestore_Magenotification_Model_Mysql4</class>
<entities>
<magenotification>
<table>magenotification</table>
</magenotification>
<feedback>
<table>magenotification_extension_feedback</table>
</feedback>
<feedbackmessage>
<table>magenotification_extension_feedbackmessage</table>
</feedbackmessage>
<logger>
<table>magenotification_log</table>
</logger>
<license>
<table>magenotification_license</table>
</license>
</entities>
</magenotification_mysql4>
</models>
SQL
<?php
$installer = $this;
$installer->startSetup();
$installer->run("
DROP TABLE IF EXISTS {$this->getTable('magenotification_extension_feedbackmessage')};
DROP TABLE IF EXISTS {$this->getTable('magenotification_extension_feedback')};
DROP TABLE IF EXISTS {$this->getTable('magenotification_log')};
DROP TABLE IF EXISTS {$this->getTable('magenotification')};
CREATE TABLE {$this->getTable('magenotification')} (
`magenotification_id` int(11) unsigned NOT NULL auto_increment,
`notification_id` int(10) unsigned NOT NULL,
`url` varchar(255) NOT NULL default '',
`added_date` datetime NOT NULL,
UNIQUE (`notification_id`, `url`),
PRIMARY KEY (`magenotification_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE {$this->getTable('magenotification_log')} (
`log_id` int(11) unsigned NOT NULL auto_increment,
`extension_code` varchar(100) NOT NULL default '',
`license_type` varchar(50) NOT NULL default '',
`license_key` text NOT NULL default '',
`check_date` date NOT NULL,
`sum_code` varchar(255),
`response_code` smallint(5),
`expired_time` varchar(255),
`is_valid` tinyint(1),
PRIMARY KEY (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE {$this->getTable('magenotification_extension_feedback')} (
`feedback_id` int(11) unsigned NOT NULL auto_increment,
`code` varchar(255) NOT NULL default '',
`extension` varchar(255) NOT NULL default '',
`extension_version` varchar(50) NOT NULL default '',
`coupon_code` varchar(255) NOT NULL default '',
`coupon_value` varchar(50) NOT NULL default '',
`expired_counpon` datetime NOT NULL,
`content` text NOT NULL default '',
`file` text NOT NULL default '',
`comment` text NOT NULL default '',
`latest_message` text NOT NULL default '',
`latest_response` text NOT NULL default '',
`latest_response_time` datetime,
`status` tinyint(1) NOT NULL DEFAULT '3',
`is_sent` tinyint(1) NOT NULL DEFAULT '2',
`created` datetime NOT NULL,
`updated` datetime NOT NULL,
PRIMARY KEY (`feedback_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE {$this->getTable('magenotification_extension_feedbackmessage')} (
`feedbackmessage_id` int(11) unsigned NOT NULL auto_increment,
`feedback_id` int(11) unsigned NOT NULL,
`feedback_code` varchar(255) NOT NULL default '',
`user` varchar(255) NOT NULL default '',
`is_customer` tinyint(1) default '2',
`message` text NOT NULL default '',
`file` text NOT NULL default '',
`posted_time` datetime NULL,
`is_sent` tinyint(1) default '2',
PRIMARY KEY (`feedbackmessage_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
");
$installer->endSetup();
You have to learn how to create custom module in magento for more information.
custom module with database

Using slash in MySQL database

I am using mysql with php Yii framework.When doing data modelling I came accross some doubt.I have a table for user details like this.
CREATE TABLE IF NOT EXISTS `tbl_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(80) NOT NULL DEFAULT '',
`lastname` varchar(80) NOT NULL DEFAULT '',
`gender` varchar(6) NOT NULL DEFAULT '',
`email` varchar(45) NOT NULL DEFAULT '',
`company_name` varchar(80) NOT NULL DEFAULT '',
`contact_no` varchar(45) NOT NULL DEFAULT '',
`address` varchar(120) NOT NULL DEFAULT '',
`state` varchar(45) NOT NULL DEFAULT '',
`country` varchar(45) NOT NULL DEFAULT '',
`created_by` int(11) DEFAULT NULL,
`updated_by` int(11) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=98 ;
Here my problem is I want the state,country should be like this so that I can use the fields like state/city
`state/city` varchar(45) NOT NULL DEFAULT '',
`state/province` varchar(45) NOT NULL DEFAULT '',
So is it safe to use like this or I have to use only one option there?Any help and suggestions will be highly appriciable.
Yes, it's valid. But you will always need to quote it with backticks.
See http://dev.mysql.com/doc/refman/5.5/en/identifiers.html for full details on what's allowed.