1
0

20230512074341_create_fish_ad_list_table.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. use think\facade\Db;
  3. use think\migration\Migrator;
  4. use think\migration\db\Column;
  5. class CreateFishAdListTable extends Migrator
  6. {
  7. /**
  8. * Change Method.
  9. *
  10. * Write your reversible migrations using this method.
  11. *
  12. * More information on writing migrations is available here:
  13. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  14. *
  15. * The following commands can be used in this method and Phinx will
  16. * automatically reverse them when rolling back:
  17. *
  18. * createTable
  19. * renameTable
  20. * addColumn
  21. * renameColumn
  22. * addIndex
  23. * addForeignKey
  24. *
  25. * Remember to call "create()" or "update()" and NOT "save()" when working
  26. * with the Table class.
  27. */
  28. public function change()
  29. {
  30. Db::execute("CREATE TABLE `fl_fish_campaign_list` (
  31. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  32. `advertiser_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '广告主ID',
  33. `campaign_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '广告组id',
  34. `campaign_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '广告组name',
  35. `ad_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '计划id',
  36. `ad_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '计划name',
  37. `stat_datetime` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据起始时间',
  38. `cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '展现数据-总花费',
  39. `show` int(11) NULL DEFAULT 0 COMMENT '展现数据-展示数',
  40. `click` int(11) NULL DEFAULT 0 COMMENT '展现数据-点击数',
  41. `avg_click_cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '展现数据-平均点击单价',
  42. `ctr` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '展现数据-点击率',
  43. `convert` int(11) NULL DEFAULT 0 COMMENT '转化数据-转化数',
  44. `convert_cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '转化数据-转化成本',
  45. `convert_rate` int(11) NULL DEFAULT 0 COMMENT '转化数据-转化率',
  46. `root_id` int(11) NULL DEFAULT 0 COMMENT '关联组织',
  47. `data_time` date NULL DEFAULT NULL COMMENT '数据日期-每日请求一次插入数据',
  48. `type` tinyint(1) NULL DEFAULT 1 COMMENT '1飞鱼2腾讯3欧派',
  49. PRIMARY KEY (`id`) USING BTREE,
  50. INDEX `root_id`(`root_id`) USING BTREE,
  51. INDEX `advertiser_id`(`advertiser_id`) USING BTREE,
  52. INDEX `ad_id`(`ad_id`) USING BTREE,
  53. INDEX `data_time`(`data_time`) USING BTREE,
  54. INDEX `campaign_id`(`campaign_id`) USING BTREE
  55. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '广告组下的广告计划' ROW_FORMAT = Dynamic;");
  56. }
  57. }